[all-commits] [llvm/llvm-project] ae4f30: [flang] Canonicalize fir.array_coor by pulling in ...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Tue Jun 4 15:21:41 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ae4f3001338c2a19167abf8dbe69d15f5209e033
      https://github.com/llvm/llvm-project/commit/ae4f3001338c2a19167abf8dbe69d15f5209e033
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2024-06-04 (Tue, 04 Jun 2024)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/FIROps.td
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    A flang/test/Fir/array-coor-canonicalization.fir

  Log Message:
  -----------
  [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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list