mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Use SimplifyDemandedBits on div instructions.
This folds away silly stuff like (a&255)/1000 -> 0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130614 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -320,6 +320,10 @@ Instruction *InstCombiner::commonIDivTransforms(BinaryOperator &I) {
|
||||
}
|
||||
}
|
||||
|
||||
// See if we can fold away this div instruction.
|
||||
if (SimplifyDemandedInstructionBits(I))
|
||||
return &I;
|
||||
|
||||
// (X - (X rem Y)) / Y -> X / Y; usually originates as ((X / Y) * Y) / Y
|
||||
Value *X = 0, *Z = 0;
|
||||
if (match(Op0, m_Sub(m_Value(X), m_Value(Z)))) { // (X - Z) / Y; Y = Op1
|
||||
|
||||
Reference in New Issue
Block a user