Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.488 -> 1.489
---
Log message:

Swap the order of operands created here.  For +&|^, the order doesn't matter,
but for sub, it really does!  Fix fixes a miscompilation of fibheap_cut in
llvmgcc4.


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

 InstructionCombining.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.488 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.489
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.488   Fri May 26 
14:19:20 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed May 31 16:14:00 2006
@@ -4437,7 +4437,7 @@
                                             Op0BO->getName());
             InsertNewInstBefore(YS, I); // (Y << C)
             Instruction *X =
-              BinaryOperator::create(Op0BO->getOpcode(), YS, V1,
+              BinaryOperator::create(Op0BO->getOpcode(), V1, YS,
                                      Op0BO->getOperand(0)->getName());
             InsertNewInstBefore(X, I);  // (X + (Y << C))
             Constant *C2 = ConstantInt::getAllOnesValue(X->getType());
@@ -4445,6 +4445,7 @@
             return BinaryOperator::createAnd(X, C2);
           }
           
+          // Turn (((X >> C)&CC) + Y) << C  ->  (X + (Y << C)) & (CC << C)
           if (isLeftShift && Op0BO->getOperand(0)->hasOneUse() &&
               match(Op0BO->getOperand(0),
                     m_And(m_Shr(m_Value(V1), m_Value(V2)),
@@ -4460,7 +4461,7 @@
                                         V1->getName()+".mask");
             InsertNewInstBefore(XM, I); // X & (CC << C)
             
-            return BinaryOperator::create(Op0BO->getOpcode(), YS, XM);
+            return BinaryOperator::create(Op0BO->getOpcode(), XM, YS);
           }
           
           break;



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

Reply via email to