diff options
| author | Dan Gohman <gohman@apple.com> | 2009-05-21 02:28:33 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-05-21 02:28:33 +0000 |
| commit | bf0002e7c17dc0158a279dac07375266594ac130 (patch) | |
| tree | 98b342c47142270144605146ad20384987dc2b71 /llvm/lib/Transforms | |
| parent | a6bed8370e512d2fb5a41e5547336b05adf186bb (diff) | |
| download | bcm5719-llvm-bf0002e7c17dc0158a279dac07375266594ac130.tar.gz bcm5719-llvm-bf0002e7c17dc0158a279dac07375266594ac130.zip | |
Teach ValueTracking a new way to analyze PHI nodes, and and teach
Instcombine to be more aggressive about using SimplifyDemandedBits
on shift nodes. This allows a shift to be simplified to zero in the
included test case.
llvm-svn: 72204
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 527ed430106..df5145da2a0 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7152,6 +7152,10 @@ Instruction *InstCombiner::commonShiftTransforms(BinaryOperator &I) { return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); } + // See if we can fold away this shift. + if (!isa<VectorType>(I.getType()) && SimplifyDemandedInstructionBits(I)) + return &I; + // Try to fold constant and into select arguments. if (isa<Constant>(Op0)) if (SelectInst *SI = dyn_cast<SelectInst>(Op1)) @@ -7171,8 +7175,6 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, // See if we can simplify any instructions used by the instruction whose sole // purpose is to compute bits we don't care about. uint32_t TypeBits = Op0->getType()->getPrimitiveSizeInBits(); - if (SimplifyDemandedInstructionBits(I)) - return &I; // shl uint X, 32 = 0 and shr ubyte Y, 9 = 0, ... just don't eliminate shr // of a signed value. |

