[all-commits] [llvm/llvm-project] bdacd5: [flang][CodeGen] add nsw to address calculations (...

Tom Eccles via All-commits all-commits at lists.llvm.org
Fri Dec 8 02:51:33 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bdacd56fd1f4825cfe19cf8de0cf24a3d1ff18fa
      https://github.com/llvm/llvm-project/commit/bdacd56fd1f4825cfe19cf8de0cf24a3d1ff18fa
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2023-12-08 (Fri, 08 Dec 2023)

  Changed paths:
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    M flang/test/Fir/array-coor.fir
    M flang/test/Fir/arrexp.fir
    M flang/test/Fir/convert-to-llvm.fir
    M flang/test/Fir/coordinateof.fir
    M flang/test/Fir/tbaa.fir

  Log Message:
  -----------
  [flang][CodeGen] add nsw to address calculations (#74709)

`nsw` is a flag for LLVM arithmetic operations meaning "no signed wrap".
If this keyword is present, the result of the operation is a poison
value if overflow occurs. Adding this keyword permits LLVM to re-order
integer arithmetic more aggressively.

In

https://discourse.llvm.org/t/rfc-changes-to-fircg-xarray-coor-codegen-to-allow-better-hoisting/75257/16
@vzakhari observed that adding nsw is useful to enable hoisting of
address calculations after some loops (or is at least a step in that
direction).

Classic flang also adds nsw to address calculations.




More information about the All-commits mailing list