mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-06 20:32:19 +00:00
Optimize ScalarEvolution::getAddExpr's operand factoring code by
having it finish processing all of the muliply operands before starting the whole getAddExpr process over again, instead of immediately after the first simplification. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110916 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
918e76b8b5
commit
727356fc7d
@ -1541,6 +1541,7 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check this multiply against other multiplies being added together.
|
// Check this multiply against other multiplies being added together.
|
||||||
|
bool AnyFold = false;
|
||||||
for (unsigned OtherMulIdx = Idx+1;
|
for (unsigned OtherMulIdx = Idx+1;
|
||||||
OtherMulIdx < Ops.size() && isa<SCEVMulExpr>(Ops[OtherMulIdx]);
|
OtherMulIdx < Ops.size() && isa<SCEVMulExpr>(Ops[OtherMulIdx]);
|
||||||
++OtherMulIdx) {
|
++OtherMulIdx) {
|
||||||
@ -1568,14 +1569,16 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
|
|||||||
const SCEV *InnerMulSum = getAddExpr(InnerMul1,InnerMul2);
|
const SCEV *InnerMulSum = getAddExpr(InnerMul1,InnerMul2);
|
||||||
const SCEV *OuterMul = getMulExpr(MulOpSCEV, InnerMulSum);
|
const SCEV *OuterMul = getMulExpr(MulOpSCEV, InnerMulSum);
|
||||||
if (Ops.size() == 2) return OuterMul;
|
if (Ops.size() == 2) return OuterMul;
|
||||||
Ops.erase(Ops.begin()+Idx);
|
Ops[Idx] = OuterMul;
|
||||||
Ops.erase(Ops.begin()+OtherMulIdx-1);
|
Ops.erase(Ops.begin()+OtherMulIdx);
|
||||||
Ops.push_back(OuterMul);
|
OtherMulIdx = Idx;
|
||||||
|
AnyFold = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (AnyFold)
|
||||||
return getAddExpr(Ops);
|
return getAddExpr(Ops);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there are any add recurrences in the operands list, see if any other
|
// If there are any add recurrences in the operands list, see if any other
|
||||||
// added values are loop invariant. If so, we can fold them into the
|
// added values are loop invariant. If so, we can fold them into the
|
||||||
|
Loading…
Reference in New Issue
Block a user