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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222398 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chad Rosier
2014-11-19 23:21:20 +00:00
parent fb1c650fd0
commit 503ec9826c
17 changed files with 60 additions and 62 deletions

View File

@ -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;