diff options
author | Dan Gohman <gohman@apple.com> | 2009-10-09 16:35:06 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-10-09 16:35:06 +0000 |
commit | dc4893abfe298ae85cf1654d93580b016f83aa1a (patch) | |
tree | 2afea64cac8780c4455d50f641d773f77e016622 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 4dc1246d87c3daafcdfb83e68484b75a4fa0ece6 (diff) | |
download | bcm5719-llvm-dc4893abfe298ae85cf1654d93580b016f83aa1a.tar.gz bcm5719-llvm-dc4893abfe298ae85cf1654d93580b016f83aa1a.zip |
Revert r83606 and add comments explaining why it isn't safe.
llvm-svn: 83649
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index bdf31f9a706..62f3aa1dcae 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -2951,20 +2951,18 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { 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))); |