diff options
author | Dan Gohman <gohman@apple.com> | 2009-10-09 00:41:22 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-10-09 00:41:22 +0000 |
commit | 837b52307f0cc56172a43dab64d2fbcfe1bd5d5f (patch) | |
tree | ea86beb54cb6e7a467e41faecfcaabd1710070ce /lib/Analysis | |
parent | fa77a95f69eb7ebf8ad5eec689ab92f2f8961f64 (diff) | |
download | external_llvm-837b52307f0cc56172a43dab64d2fbcfe1bd5d5f.zip external_llvm-837b52307f0cc56172a43dab64d2fbcfe1bd5d5f.tar.gz external_llvm-837b52307f0cc56172a43dab64d2fbcfe1bd5d5f.tar.bz2 |
Preserve HasNSW and HasNUW when constructing SCEVs for Add and Mul
instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83606 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 9300de1..bdf31f9 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -2951,12 +2951,20 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { Operator *U = cast<Operator>(V); switch (Opcode) { - case Instruction::Add: + case Instruction::Add: { + AddOperator *A = cast<AddOperator>(U); return getAddExpr(getSCEV(U->getOperand(0)), - getSCEV(U->getOperand(1))); - case Instruction::Mul: + getSCEV(U->getOperand(1)), + A->hasNoUnsignedWrap(), + A->hasNoSignedWrap()); + } + case Instruction::Mul: { + MulOperator *M = cast<MulOperator>(U); return getMulExpr(getSCEV(U->getOperand(0)), - getSCEV(U->getOperand(1))); + getSCEV(U->getOperand(1)), + M->hasNoUnsignedWrap(), + M->hasNoSignedWrap()); + } case Instruction::UDiv: return getUDivExpr(getSCEV(U->getOperand(0)), getSCEV(U->getOperand(1))); |