[PATCH] D149132: [LICM] Reassociate & hoist add expressions

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 00:08:45 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:2577
+  // LHS itself is a loop-variant, try to represent it in the form:
+  // "VariantOp + InvariantOp". If it it possible, then we can reassociate.
+  if (L.isLoopInvariant(VariantOp))
----------------
If it is


================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:2590-2591
+      cast<OverflowingBinaryOperator>(LHS)->hasNoSignedWrap() ||
+      computeOverflowForSignedAdd(VariantOp, InvariantOp, DL, AC, /*CtxI*/ &I,
+                                  DT) == OverflowResult::NeverOverflows;
+  if (!ProvedNoOverflowBeforeReassociate)
----------------
InstCombine will do exactly this inference already, so I think we should only be checking the nsw flag here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149132/new/

https://reviews.llvm.org/D149132



More information about the llvm-commits mailing list