summaryrefslogtreecommitdiff
path: root/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-02-02 20:52:00 +0000
committerDuncan Sands <baldrick@free.fr>2011-02-02 20:52:00 +0000
commit4b720718fbda1194f925e0a9d931bc220e8b0e3a (patch)
tree4580e5c6f9c1fb68da8f79d786218f13665453f9 /lib/Analysis/InstructionSimplify.cpp
parent79fcb6dec3e6e30a30835ebc781e5abc275e12e9 (diff)
downloadllvm-4b720718fbda1194f925e0a9d931bc220e8b0e3a.tar.gz
llvm-4b720718fbda1194f925e0a9d931bc220e8b0e3a.tar.bz2
llvm-4b720718fbda1194f925e0a9d931bc220e8b0e3a.tar.xz
Reenable the transform "(X*Y)/Y->X" when the multiplication is known not to
overflow (nsw flag), which was disabled because it breaks 254.gap. I have informed the GAP authors of the mistake in their code, and arranged for the testsuite to use -fwrapv when compiling this benchmark. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124746 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--lib/Analysis/InstructionSimplify.cpp10
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)