diff options
| author | Dan Gohman <gohman@apple.com> | 2009-03-04 19:23:38 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-03-04 19:23:38 +0000 |
| commit | cc329b567d87ec88edae4f0203a2303dbabb1899 (patch) | |
| tree | b604d2494f1e53ead65c1bae9dd7a00bb30fb25c /llvm | |
| parent | a41bb40458cc914874f41ca9531dc6b8eef93cd2 (diff) | |
| download | bcm5719-llvm-cc329b567d87ec88edae4f0203a2303dbabb1899.tar.gz bcm5719-llvm-cc329b567d87ec88edae4f0203a2303dbabb1899.zip | |
When using MachineInstr operand indices on SDNodes, the number
of MachineInstr def operands must be subtracted out. This bug
was uncovered by the recent x86 EFLAGS optimization. Before
that, the only instructions that ever needed unfolding were
things like CMP32rm, where NumDefs is zero.
llvm-svn: 66056
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Target/X86/X86InstrInfo.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index 1d1db14efe3..3de7dfce88a 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -2382,6 +2382,7 @@ X86InstrInfo::unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N, const TargetOperandInfo &TOI = TID.OpInfo[Index]; const TargetRegisterClass *RC = TOI.isLookupPtrRegClass() ? RI.getPointerRegClass() : RI.getRegClass(TOI.RegClass); + unsigned NumDefs = TID.NumDefs; std::vector<SDValue> AddrOps; std::vector<SDValue> BeforeOps; std::vector<SDValue> AfterOps; @@ -2389,11 +2390,11 @@ X86InstrInfo::unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N, unsigned NumOps = N->getNumOperands(); for (unsigned i = 0; i != NumOps-1; ++i) { SDValue Op = N->getOperand(i); - if (i >= Index && i < Index+4) + if (i >= Index-NumDefs && i < Index-NumDefs+4) AddrOps.push_back(Op); - else if (i < Index) + else if (i < Index-NumDefs) BeforeOps.push_back(Op); - else if (i > Index) + else if (i > Index-NumDefs) AfterOps.push_back(Op); } SDValue Chain = N->getOperand(NumOps-1); |

