summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-10-09 00:41:22 +0000
committerDan Gohman <gohman@apple.com>2009-10-09 00:41:22 +0000
commitd65387a49f6872b0301158fe4ea12cfb7db091ae (patch)
tree8f3cb5e49fde5a9e31d3c342d94fc301142e0c5d /llvm/lib/Analysis/ScalarEvolution.cpp
parent29f9d395683b0aa99145ef7ba0c635f4b364df5c (diff)
downloadbcm5719-llvm-d65387a49f6872b0301158fe4ea12cfb7db091ae.tar.gz
bcm5719-llvm-d65387a49f6872b0301158fe4ea12cfb7db091ae.zip
Preserve HasNSW and HasNUW when constructing SCEVs for Add and Mul
instructions. llvm-svn: 83606
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 9300de11685..bdf31f9a706 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/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)));
OpenPOWER on IntegriCloud