1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00

Fix bug: Reassociate/2003-08-12-InfiniteLoop.ll

llvm-svn: 7792
This commit is contained in:
Chris Lattner 2003-08-12 21:45:24 +00:00
parent 2633d5c2b1
commit 7105c4aad0

View File

@ -126,12 +126,13 @@ bool Reassociate::ReassociateExpr(BinaryOperator *I) {
if (LHSI->getOpcode() == I->getOpcode() && LHSI->use_size() == 1) {
// If the rank of our current RHS is less than the rank of the LHS's LHS,
// then we reassociate the two instructions...
if (RHSRank < getRank(LHSI->getOperand(0))) {
unsigned TakeOp = 0;
if (BinaryOperator *IOp = dyn_cast<BinaryOperator>(LHSI->getOperand(0)))
if (IOp->getOpcode() == LHSI->getOpcode())
TakeOp = 1; // Hoist out non-tree portion
unsigned TakeOp = 0;
if (BinaryOperator *IOp = dyn_cast<BinaryOperator>(LHSI->getOperand(0)))
if (IOp->getOpcode() == LHSI->getOpcode())
TakeOp = 1; // Hoist out non-tree portion
if (RHSRank < getRank(LHSI->getOperand(TakeOp))) {
// Convert ((a + 12) + 10) into (a + (12 + 10))
I->setOperand(0, LHSI->getOperand(TakeOp));
LHSI->setOperand(TakeOp, RHS);