[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon May 10 10:17:27 PDT 2004


Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.249 -> 1.250

---
Log message:

Fix a fairly serious pessimizaion that was preventing us from efficiently
compiling things like 'add long %X, 1'.  The problem is that we were switching
the order of the operands for longs even though we can't fold them yet.


---
Diffs of the changes:  (+3 -2)

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.249 llvm/lib/Target/X86/InstSelectSimple.cpp:1.250
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.249	Sun May  9 18:16:33 2004
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Mon May 10 10:15:55 2004
@@ -1863,13 +1863,14 @@
   unsigned DestReg = getReg(B);
   MachineBasicBlock::iterator MI = BB->end();
   Value *Op0 = B.getOperand(0), *Op1 = B.getOperand(1);
+  unsigned Class = getClassB(B.getType());
 
   // Special case: op Reg, load [mem]
-  if (isa<LoadInst>(Op0) && !isa<LoadInst>(Op1))
+  if (isa<LoadInst>(Op0) && !isa<LoadInst>(Op1) && Class != cLong &&
+      isSafeToFoldLoadIntoInstruction(*cast<LoadInst>(Op0), B))
     if (!B.swapOperands())
       std::swap(Op0, Op1);  // Make sure any loads are in the RHS.
 
-  unsigned Class = getClassB(B.getType());
   if (isa<LoadInst>(Op1) && Class != cLong &&
       isSafeToFoldLoadIntoInstruction(*cast<LoadInst>(Op1), B)) {
 





More information about the llvm-commits mailing list