[PATCH] D13685: [SCEV] Commute sign extends through nsw additions

Nick Lewycky via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 15:47:46 PDT 2015


nlewycky added inline comments.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:1634
@@ -1633,1 +1633,3 @@
     }
+
+    if (SA->getNoWrapFlags(SCEV::FlagNSW)) {
----------------
// sext(A +nsw B +nsw ... ) --> sext(A) +nsw sext(B) +nsw ...

================
Comment at: lib/Analysis/ScalarEvolution.cpp:1635-1637
@@ +1634,5 @@
+
+    if (SA->getNoWrapFlags(SCEV::FlagNSW)) {
+      // If the addition does not sign overflow then we can, by definition,
+      // commute the sign extension with the addition operation.
+      SmallVector<const SCEV *, 4> Ops;
----------------
Any reason not to do this with zext and nuw?


http://reviews.llvm.org/D13685





More information about the llvm-commits mailing list