[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 26 22:57:29 PDT 2004



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.276 -> 1.277
---
Log message:

Hrm, this code was severely botched.  As it turns out, this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041018/019708.html

exposed ANOTHER latent bug in this xform, which caused Prolangs-C/bison to fill
the zion nightly tester disk up and make the tester barf.

This is obviously not a good thing, so lets fix this bug shall we? :)


---
Diffs of the changes:  (+4 -0)

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.276 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.277
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.276	Thu Oct 21 23:53:16 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Wed Oct 27 00:57:15 2004
@@ -1294,6 +1294,10 @@
           ShVal = InsertNewInstBefore(new ShiftInst(Instruction::Shr, ShVal,
                                                     OpRHS, Op->getName()),
                                       TheAnd);
+          Value *AndRHS2 = ConstantExpr::getCast(AndRHS, ShVal->getType());
+          ShVal = InsertNewInstBefore(BinaryOperator::createAnd(ShVal, AndRHS2,
+                                                             TheAnd.getName()),
+                                      TheAnd);
           return new CastInst(ShVal, Op->getType());
         }
       }






More information about the llvm-commits mailing list