OSDN Git Service

Little patch to turn (shl (add X, 123), 4) -> (add (shl X, 4), 123 << 4)
authorChris Lattner <sabre@nondot.org>
Fri, 8 Oct 2004 03:46:20 +0000 (03:46 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 8 Oct 2004 03:46:20 +0000 (03:46 +0000)
This triggers in cases of bitfield additions, opening opportunities for
future improvements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16834 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 767fc95..3febd1d 100644 (file)
@@ -2496,6 +2496,9 @@ Instruction *InstCombiner::visitShiftInst(ShiftInst &I) {
 
           switch (Op0BO->getOpcode()) {
           default: isValid = false; break;   // Do not perform transform!
+          case Instruction::Add:
+            isValid = isLeftShift;
+            break;
           case Instruction::Or:
           case Instruction::Xor:
             highBitSet = false;