summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@codeaurora.org>2014-11-19 23:21:20 +0000
committerChad Rosier <mcrosier@codeaurora.org>2014-11-19 23:21:20 +0000
commit90a2f9b1103733dace968461c0715be10e6d7f41 (patch)
tree5eba1b4f44b7ddc78718ade9d60212305b8e14f0 /llvm/lib/Transforms/Scalar
parent36577d037f7bf7cdddb2e1f6cce62c52aee04a14 (diff)
downloadbcm5719-llvm-90a2f9b1103733dace968461c0715be10e6d7f41.tar.gz
bcm5719-llvm-90a2f9b1103733dace968461c0715be10e6d7f41.zip
Revert "[Reassociate] As the expression tree is rewritten make sure the operands are"
This reverts commit r222142. This is causing/exposing an execution-time regression in spec2006/gcc and coremark on AArch64/A57/Ofast. Conflicts: test/Transforms/Reassociate/optional-flags.ll llvm-svn: 222398
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/Reassociate.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
index e75fa8017bd..1bbaaf34603 100644
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -791,11 +791,14 @@ void Reassociate::RewriteExprTree(BinaryOperator *I,
Value *OldLHS = Op->getOperand(0);
Value *OldRHS = Op->getOperand(1);
- // The new operation differs trivially from the original.
- if ((NewLHS == OldLHS && NewRHS == OldRHS) ||
- (NewLHS == OldRHS && NewRHS == OldLHS)) {
+ if (NewLHS == OldLHS && NewRHS == OldRHS)
+ // Nothing changed, leave it alone.
+ break;
+
+ if (NewLHS == OldRHS && NewRHS == OldLHS) {
+ // The order of the operands was reversed. Swap them.
DEBUG(dbgs() << "RA: " << *Op << '\n');
- canonicalizeOperands(Op);
+ Op->swapOperands();
DEBUG(dbgs() << "TO: " << *Op << '\n');
MadeChange = true;
++NumChanged;
@@ -817,8 +820,6 @@ void Reassociate::RewriteExprTree(BinaryOperator *I,
NodesToRewrite.push_back(BO);
Op->setOperand(1, NewRHS);
}
- // Put the operands in canonical form.
- canonicalizeOperands(Op);
DEBUG(dbgs() << "TO: " << *Op << '\n');
ExpressionChanged = Op;
@@ -855,7 +856,6 @@ void Reassociate::RewriteExprTree(BinaryOperator *I,
// into it.
BinaryOperator *BO = isReassociableOp(Op->getOperand(0), Opcode);
if (BO && !NotRewritable.count(BO)) {
- canonicalizeOperands(Op);
Op = BO;
continue;
}
@@ -880,7 +880,6 @@ void Reassociate::RewriteExprTree(BinaryOperator *I,
DEBUG(dbgs() << "RA: " << *Op << '\n');
Op->setOperand(0, NewOp);
- canonicalizeOperands(Op);
DEBUG(dbgs() << "TO: " << *Op << '\n');
ExpressionChanged = Op;
MadeChange = true;
OpenPOWER on IntegriCloud