diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-08 16:16:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-08 16:16:40 +0000 |
commit | 6eaeb5764cc683c356ad1a8c13ad94151de030f2 (patch) | |
tree | a0ac2fb0038b7fc64247813e77b7ebb7d907d5c9 /lib/Transforms | |
parent | af1b4ad24cd4c4773498e25a9f6296e49e50d593 (diff) | |
download | external_llvm-6eaeb5764cc683c356ad1a8c13ad94151de030f2.zip external_llvm-6eaeb5764cc683c356ad1a8c13ad94151de030f2.tar.gz external_llvm-6eaeb5764cc683c356ad1a8c13ad94151de030f2.tar.bz2 |
Fold ashr -1, X into -1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4070 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index ec3ea07..f0e6397 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -503,6 +503,12 @@ Instruction *InstCombiner::visitShiftInst(Instruction &I) { return BinaryOperator::create(Instruction::Add, Op0, Op0, I.getName()); } + + // shr int -1, X = -1 (for any arithmetic shift rights of ~0) + if (ConstantSInt *CSI = dyn_cast<ConstantSInt>(Op0)) + if (I.getOpcode() == Instruction::Shr && CSI->isAllOnesValue()) + return ReplaceInstUsesWith(I, CSI); + return 0; } |