[llvm-commits] [llvm] r83649 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Dan Gohman
gohman at apple.com
Fri Oct 9 09:35:06 PDT 2009
Author: djg
Date: Fri Oct 9 11:35:06 2009
New Revision: 83649
URL: http://llvm.org/viewvc/llvm-project?rev=83649&view=rev
Log:
Revert r83606 and add comments explaining why it isn't safe.
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=83649&r1=83648&r2=83649&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Oct 9 11:35:06 2009
@@ -2951,20 +2951,18 @@
Operator *U = cast<Operator>(V);
switch (Opcode) {
- case Instruction::Add: {
- AddOperator *A = cast<AddOperator>(U);
+ case Instruction::Add:
+ // Don't transfer the NSW and NUW bits from the Add instruction to the
+ // Add expression, because the Instruction may be guarded by control
+ // flow and the no-overflow bits may not be valid for the expression in
+ // any context.
return getAddExpr(getSCEV(U->getOperand(0)),
- getSCEV(U->getOperand(1)),
- A->hasNoUnsignedWrap(),
- A->hasNoSignedWrap());
- }
- case Instruction::Mul: {
- MulOperator *M = cast<MulOperator>(U);
+ getSCEV(U->getOperand(1)));
+ case Instruction::Mul:
+ // Don't transfer the NSW and NUW bits from the Mul instruction to the
+ // Mul expression, as with Add.
return getMulExpr(getSCEV(U->getOperand(0)),
- getSCEV(U->getOperand(1)),
- M->hasNoUnsignedWrap(),
- M->hasNoSignedWrap());
- }
+ getSCEV(U->getOperand(1)));
case Instruction::UDiv:
return getUDivExpr(getSCEV(U->getOperand(0)),
getSCEV(U->getOperand(1)));
More information about the llvm-commits
mailing list