mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-17 18:24:34 +00:00
Transform -X/C to X/-C, implementing a README.txt entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78812 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3077,6 +3077,14 @@ Instruction *InstCombiner::visitSDiv(BinaryOperator &I) {
|
||||
RHS->getValue().exactLogBase2());
|
||||
return BinaryOperator::CreateAShr(Op0, ShAmt, I.getName());
|
||||
}
|
||||
|
||||
// -X/C --> X/-C provided the negation doesn't overflow.
|
||||
if (SubOperator *Sub = dyn_cast<SubOperator>(Op0))
|
||||
if (isa<Constant>(Sub->getOperand(0)) &&
|
||||
cast<Constant>(Sub->getOperand(0))->isNullValue() &&
|
||||
Sub->hasNoSignedOverflow())
|
||||
return BinaryOperator::CreateSDiv(Sub->getOperand(1),
|
||||
ConstantExpr::getNeg(RHS));
|
||||
}
|
||||
|
||||
// If the sign bits of both operands are zero (i.e. we can prove they are
|
||||
|
Reference in New Issue
Block a user