[PATCH] D13613: [SCEV] Mark AddExprs as nsw or nuw if legal

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 18:39:34 PDT 2015


reames added a subscriber: reames.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:1946
@@ -1944,2 +1945,3 @@
 
-  return OldFlags;
+  if (SignOrUnsignWrap != SignOrUnsignMask && Type == scAddExpr &&
+      Ops.size() == 2 && isa<SCEVConstant>(Ops[0])) {
----------------
Comment?  

================
Comment at: lib/Analysis/ScalarEvolution.cpp:1949
@@ +1948,3 @@
+    const APInt &C = cast<SCEVConstant>(Ops[0])->getValue()->getValue();
+    if (!(SignOrUnsignWrap & SCEV::FlagNSW)) {
+      auto NSWRegion =
----------------
Given we could have learned a new fact at line 1643, shouldn't this be using that new fact?


http://reviews.llvm.org/D13613





More information about the llvm-commits mailing list