[llvm-commits] [llvm] r66496 - /llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp

Dan Gohman gohman at apple.com
Mon Mar 9 16:23:12 PDT 2009


Author: djg
Date: Mon Mar  9 18:23:12 2009
New Revision: 66496

URL: http://llvm.org/viewvc/llvm-project?rev=66496&view=rev
Log:
Merge from trunk:

r66056 | djg | 2009-03-04 11:23:38 -0800 (Wed, 04 Mar 2009) | 6 lines

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.

Modified:
    llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp

Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp?rev=66496&r1=66495&r2=66496&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp Mon Mar  9 18:23:12 2009
@@ -2404,6 +2404,7 @@
   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;
@@ -2411,11 +2412,11 @@
   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);





More information about the llvm-commits mailing list