mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
Add a fast path for x - x.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108855 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2442,6 +2442,10 @@ const SCEV *ScalarEvolution::getNotSCEV(const SCEV *V) {
|
|||||||
///
|
///
|
||||||
const SCEV *ScalarEvolution::getMinusSCEV(const SCEV *LHS,
|
const SCEV *ScalarEvolution::getMinusSCEV(const SCEV *LHS,
|
||||||
const SCEV *RHS) {
|
const SCEV *RHS) {
|
||||||
|
// Fast path: X - X --> 0.
|
||||||
|
if (LHS == RHS)
|
||||||
|
return getConstant(LHS->getType(), 0);
|
||||||
|
|
||||||
// X - Y --> X + -Y
|
// X - Y --> X + -Y
|
||||||
return getAddExpr(LHS, getNegativeSCEV(RHS));
|
return getAddExpr(LHS, getNegativeSCEV(RHS));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user