summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commit5747abab10b00a7f84458cc3fb41715b4790239a (patch)
tree813765a7a5f7d04b89b4df8bdb48d26592b59f2b /llvm/lib
parent09b2331cf7a03a8f372edfb5123048a86d8b4df7 (diff)
downloadbcm5719-llvm-5747abab10b00a7f84458cc3fb41715b4790239a.tar.gz
bcm5719-llvm-5747abab10b00a7f84458cc3fb41715b4790239a.zip
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. llvm-svn: 124746
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 6ca4dddcf36..4b9b648aa6c 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/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)
OpenPOWER on IntegriCloud