From: Chris Lattner Date: Fri, 8 Oct 2004 03:46:20 +0000 (+0000) Subject: Little patch to turn (shl (add X, 123), 4) -> (add (shl X, 4), 123 << 4) X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1f7e160f77c9c0f042c3098b16ad659f3d7e74b4;p=oota-llvm.git Little patch to turn (shl (add X, 123), 4) -> (add (shl X, 4), 123 << 4) 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 --- diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 767fc9582b0..3febd1dd46f 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -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;