diff options
author | Chris Lattner <sabre@nondot.org> | 2004-03-26 16:11:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-03-26 16:11:24 +0000 |
commit | 4df1b8aa2629d87fe4c23b0bc6fa5f5ea0fbaced (patch) | |
tree | 8f6e32591311a0091d49ca5258c8045e09b8ecc9 /lib | |
parent | ebd985cb87e9847892c2fcb270f698fcf085e2fb (diff) | |
download | external_llvm-4df1b8aa2629d87fe4c23b0bc6fa5f5ea0fbaced.zip external_llvm-4df1b8aa2629d87fe4c23b0bc6fa5f5ea0fbaced.tar.gz external_llvm-4df1b8aa2629d87fe4c23b0bc6fa5f5ea0fbaced.tar.bz2 |
X % -1 == X % 1 == 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index f2fe8d5..9b91705 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -808,6 +808,8 @@ Instruction *InstCombiner::visitRem(BinaryOperator &I) { if (ConstantInt *RHS = dyn_cast<ConstantInt>(I.getOperand(1))) { if (RHS->equalsInt(1)) // X % 1 == 0 return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); + if (RHS->isAllOnesValue()) // X % -1 == 0 + return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); // Check to see if this is an unsigned remainder with an exact power of 2, // if so, convert to a bitwise and. |