diff options
Diffstat (limited to 'lib/Analysis/InstructionSimplify.cpp')
-rw-r--r-- | lib/Analysis/InstructionSimplify.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index 6ca4dddcf3..4b9b648aa6 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -798,11 +798,11 @@ static Value *SimplifyDiv(unsigned Opcode, Value *Op0, Value *Op1, Value *X = 0, *Y = 0; if (match(Op0, m_Mul(m_Value(X), m_Value(Y))) && (X == Op1 || Y == Op1)) { if (Y != Op1) std::swap(X, Y); // Ensure expression is (X * Y) / Y, Y = Op1 -// BinaryOperator *Mul = cast<BinaryOperator>(Op0); -// // If the Mul knows it does not overflow, then we are good to go. -// if ((isSigned && Mul->hasNoSignedWrap()) || -// (!isSigned && Mul->hasNoUnsignedWrap())) -// return X; + BinaryOperator *Mul = cast<BinaryOperator>(Op0); + // If the Mul knows it does not overflow, then we are good to go. + if ((isSigned && Mul->hasNoSignedWrap()) || + (!isSigned && Mul->hasNoUnsignedWrap())) + return X; // If X has the form X = A / Y then X * Y cannot overflow. if (BinaryOperator *Div = dyn_cast<BinaryOperator>(X)) if (Div->getOpcode() == Opcode && Div->getOperand(1) == Y) |