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

Evan Cheng evan.cheng at apple.com
Wed Jan 25 01:05:34 PST 2006



Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.54 -> 1.55
---
Log message:

Fix a selectcc lowering bug. Make a copy of X86ISD::CMP when folding it.


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

 X86ISelLowering.cpp |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.54 llvm/lib/Target/X86/X86ISelLowering.cpp:1.55
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.54	Tue Jan 24 00:14:44 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp	Wed Jan 25 03:05:09 2006
@@ -1696,9 +1696,14 @@
       // If the X86ISD::SETCC has more than one use, then it's probably better
       // to use a test instead of duplicating the X86ISD::CMP (for register
       // pressure reason).
+      // FIXME: Check number of live Op0 uses since we are in the middle of 
+      // legalization process.
       if (Op0.hasOneUse() && Op0.getOperand(1).getOpcode() == X86ISD::CMP) {
         CC   = Op0.getOperand(0);
         Cond = Op0.getOperand(1);
+        // Make a copy as flag result cannot be used by more than one.
+        Cond = DAG.getNode(X86ISD::CMP, MVT::Flag,
+                           Cond.getOperand(0), Cond.getOperand(1));
         addTest =
           isFPStack && !hasFPCMov(cast<ConstantSDNode>(CC)->getSignExtended());
       } else
@@ -1742,11 +1747,14 @@
       // If the X86ISD::SETCC has more than one use, then it's probably better
       // to use a test instead of duplicating the X86ISD::CMP (for register
       // pressure reason).
+      // FIXME: Check number of live Cond uses since we are in the middle of 
+      // legalization process.
       if (Cond.hasOneUse() && Cond.getOperand(1).getOpcode() == X86ISD::CMP) {
         CC   = Cond.getOperand(0);
+        Cond = Cond.getOperand(1);
+        // Make a copy as flag result cannot be used by more than one.
         Cond = DAG.getNode(X86ISD::CMP, MVT::Flag,
-                           Cond.getOperand(1).getOperand(0),
-                           Cond.getOperand(1).getOperand(1));
+                           Cond.getOperand(0), Cond.getOperand(1));
       } else
         addTest = true;
     } else if (Cond.getOpcode() == ISD::SETCC) {






More information about the llvm-commits mailing list