[flang] Canonicalize fir.array_coor by pulling in embox/rebox. (#92858)
In a simple case like this: ``` program test integer :: u(120, 2) u(1:120,1:2) = u(1:120,1:2) + 2 end program ``` Flang is creating a copy loop with fir.array_coor using a result of fir.embox inserted before the loop. This results in split address computations before and inside the loop, which can be seen as many more arithmetic operations than required after converting FIR to LLVM dialect. Even though LLVM SROA/mem2reg are able to optimize the temporary descriptor, and then LICM is able to hoist the invariant computations, we seem to get better mix of LLVM dialect operations after FIR-to-LLVM codegen. This may also slightly reduce the compilation time taken by LLVM to optimize the generate LLVM IR. This may also slightly reduce the time spent by FIR AliasAnalysis to reach the memory reference source.
parent
cb09b5f3
Please register or sign in to comment