mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-03 09:21:02 +00:00
X % -1 == X % 1 == 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12520 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ebd985cb87
commit
4df1b8aa26
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user