diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 9300de11685..bdf31f9a706 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -2951,12 +2951,20 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { Operator *U = cast(V); switch (Opcode) { - case Instruction::Add: + case Instruction::Add: { + AddOperator *A = cast(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(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)));