Rely on the code in MatchAddress to do this work. Otherwise we fail to

match (X+Y)+(Z << 1), because we match the X+Y first, consuming the index
register, then there is no place to put the Z.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19652 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-01-18 02:25:52 +00:00
parent 6e4e7652d8
commit 883c86f510

View File

@ -1579,8 +1579,11 @@ unsigned ISel::SelectExpr(SDOperand N) {
// See if we can codegen this as an LEA to fold operations together. // See if we can codegen this as an LEA to fold operations together.
if (N.getValueType() == MVT::i32) { if (N.getValueType() == MVT::i32) {
ExprMap.erase(N);
X86ISelAddressMode AM; X86ISelAddressMode AM;
if (!MatchAddress(Op0, AM) && !MatchAddress(Op1, AM)) { MatchAddress(N, AM);
ExprMap[N] = Result;
// If this is not just an add, emit the LEA. For a simple add (like // If this is not just an add, emit the LEA. For a simple add (like
// reg+reg or reg+imm), we just emit an add. It might be a good idea to // reg+reg or reg+imm), we just emit an add. It might be a good idea to
// leave this as LEA, then peephole it to 'ADD' after two address elim // leave this as LEA, then peephole it to 'ADD' after two address elim
@ -1592,7 +1595,6 @@ unsigned ISel::SelectExpr(SDOperand N) {
return Result; return Result;
} }
} }
}
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Op1)) { if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Op1)) {
Opc = 0; Opc = 0;