[llvm-commits] [llvm] r91701 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Dan Gohman gohman at apple.com
Fri Dec 18 10:45:31 PST 2009


Author: djg
Date: Fri Dec 18 12:45:31 2009
New Revision: 91701

URL: http://llvm.org/viewvc/llvm-project?rev=91701&view=rev
Log:
Revert this use of NUW/NSW also. Overflow-undefined multiplication isn't
associative either.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=91701&r1=91700&r2=91701&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Dec 18 12:45:31 2009
@@ -1460,7 +1460,10 @@
                                              AddRec->op_end());
       AddRecOps[0] = getAddExpr(LIOps);
 
+      // It's tempting to propogate NUW/NSW flags here, but nuw/nsw addition
+      // is not associative so this isn't necessarily safe.
       const SCEV *NewRec = getAddRecExpr(AddRecOps, AddRec->getLoop());
+
       // If all of the other operands were loop invariant, we are done.
       if (Ops.size() == 1) return NewRec;
 
@@ -1636,9 +1639,9 @@
         }
       }
 
-      const SCEV *NewRec = getAddRecExpr(NewOps, AddRec->getLoop(),
-                                         AddRec->hasNoUnsignedWrap() && HasNUW,
-                                         AddRec->hasNoSignedWrap() && HasNSW);
+      // It's tempting to propogate NUW/NSW flags here, but nuw/nsw multiplication
+      // is not associative so this isn't necessarily safe.
+      const SCEV *NewRec = getAddRecExpr(NewOps, AddRec->getLoop());
 
       // If all of the other operands were loop invariant, we are done.
       if (Ops.size() == 1) return NewRec;





More information about the llvm-commits mailing list