Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.530 -> 1.531
---
Log message:

Fix a bug in the previous patch


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

 InstructionCombining.cpp |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.530 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.531
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.530   Tue Oct 31 
22:51:18 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Oct 31 22:55:47 2006
@@ -6787,13 +6787,16 @@
   Instruction *FirstInst = cast<Instruction>(PN.getIncomingValue(0));
   assert(isa<BinaryOperator>(FirstInst) || isa<ShiftInst>(FirstInst));
   unsigned Opc = FirstInst->getOpcode();
+  const Type *LHSType = FirstInst->getOperand(0)->getType();
   
   // Scan to see if all operands are the same opcode, all have one use, and all
   // kill their operands (i.e. the operands have one use).
-  unsigned NumValues = PN.getNumIncomingValues();
-  for (unsigned i = 0; i != NumValues; ++i) {
+  for (unsigned i = 0; i != PN.getNumIncomingValues(); ++i) {
     Instruction *I = dyn_cast<Instruction>(PN.getIncomingValue(i));
-    if (!I || I->getOpcode() != Opc || !I->hasOneUse())
+    if (!I || I->getOpcode() != Opc || !I->hasOneUse() ||
+        // Verify type of the LHS matches so we don't fold setcc's of different
+        // types.
+        I->getOperand(0)->getType() != LHSType)
       return 0;
   }
   



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to