llvm-project
b5e18ba8 - [Flang][HLFIR] Lower PACK(array, .TRUE.) to hlfir.reshape (#213603)

Commit
18 hours ago
[Flang][HLFIR] Lower PACK(array, .TRUE.) to hlfir.reshape (#213603) When the PACK mask is the compile-time scalar .TRUE., the result is equivalent to RESHAPE(array, [SIZE(array)]). Detect this case during HLFIR intrinsic lowering and emit hlfir.reshape, reusing the same operation as the RESHAPE intrinsic rather than calling _FortranAPack. This allows later optimization passes to handle the operation as a reshape instead of going through the general PACK runtime. Variable or array masks, VECTOR, and non-trivial or polymorphic operands continue to use the existing runtime PACK path. Assisted by: Claude
Author
Parents
Loading