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

Chris Lattner lattner at cs.uiuc.edu
Fri May 12 19:16:22 PDT 2006



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.480 -> 1.481
---
Log message:

Add/Sub/Mul are safe to promote here as well.  Incrementing a single-bit
bitfield now gives this code:

_plus:
        lwz r2, 0(r3)
        rlwimi r2, r2, 0, 1, 31
        xoris r2, r2, 32768
        stw r2, 0(r3)
        blr

instead of this:

_plus:
        lwz r2, 0(r3)
        srwi r4, r2, 31
        slwi r4, r4, 31
        addis r4, r4, -32768
        rlwimi r2, r4, 0, 0, 0
        stw r2, 0(r3)
        blr

this can obviously still be improved.



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

 InstructionCombining.cpp |    6 ++++++
 1 files changed, 6 insertions(+)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.480 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.481
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.480	Fri May 12 21:06:03 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Fri May 12 21:16:08 2006
@@ -4793,6 +4793,9 @@
   if (!I || !I->hasOneUse()) return false;
   
   switch (I->getOpcode()) {
+  case Instruction::Add:
+  case Instruction::Sub:
+  case Instruction::Mul:
   case Instruction::And:
   case Instruction::Or:
   case Instruction::Xor:
@@ -4824,6 +4827,9 @@
   Instruction *I = cast<Instruction>(V);
   Instruction *Res;
   switch (I->getOpcode()) {
+  case Instruction::Add:
+  case Instruction::Sub:
+  case Instruction::Mul:
   case Instruction::And:
   case Instruction::Or:
   case Instruction::Xor: {






More information about the llvm-commits mailing list