mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-27 14:24:40 +00:00
InstCombine: Add a missing irem identity (X % X -> 0).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119538 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -551,6 +551,10 @@ Instruction *InstCombiner::commonIRemTransforms(BinaryOperator &I) {
|
||||
if (Instruction *common = commonRemTransforms(I))
|
||||
return common;
|
||||
|
||||
// X % X == 0
|
||||
if (Op0 == Op1)
|
||||
return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
|
||||
|
||||
// 0 % X == 0 for integer, we don't need to preserve faults!
|
||||
if (Constant *LHS = dyn_cast<Constant>(Op0))
|
||||
if (LHS->isNullValue())
|
||||
|
Reference in New Issue
Block a user