[NFC] Fold isHugeExpression into hasHugeExpression and update callers

accordingly.
This commit is contained in:
Eric Christopher 2020-01-16 15:28:14 -08:00
parent b82d18e1e8
commit de022a8824
1 changed files with 6 additions and 10 deletions

View File

@ -872,15 +872,12 @@ static inline int sizeOfSCEV(const SCEV *S) {
return F.Size;
}
/// Returns true if the subtree of \p S contains at least HugeExprThreshold
/// nodes.
static bool isHugeExpression(const SCEV *S) {
return S->getExpressionSize() >= HugeExprThreshold;
}
/// Returns true of \p Ops contains a huge SCEV (see definition above).
/// Returns true if \p Ops contains a huge SCEV (the subtree of S contains at
/// least HugeExprThreshold nodes).
static bool hasHugeExpression(ArrayRef<const SCEV *> Ops) {
return any_of(Ops, isHugeExpression);
return any_of(Ops, [](const SCEV *S) {
return S->getExpressionSize() >= HugeExprThreshold;
});
}
namespace {
@ -3104,8 +3101,7 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
// Limit max number of arguments to avoid creation of unreasonably big
// SCEVAddRecs with very complex operands.
if (AddRec->getNumOperands() + OtherAddRec->getNumOperands() - 1 >
MaxAddRecSize || isHugeExpression(AddRec) ||
isHugeExpression(OtherAddRec))
MaxAddRecSize || hasHugeExpression({AddRec, OtherAddRec}))
continue;
bool Overflow = false;