[SCEV][NFC] Introduce API for getting basic block's symbolic max exit count

Currently, it just returns exact exit count. This is a refectoring step
before it is actually implemented.
This commit is contained in:
Max Kazantsev 2022-11-22 15:52:49 +07:00
parent 0cf2286cb8
commit f285be6214
2 changed files with 12 additions and 1 deletions

View File

@ -1462,6 +1462,10 @@ private:
/// Get the symbolic max backedge taken count for the loop.
const SCEV *getSymbolicMax(const Loop *L, ScalarEvolution *SE);
/// Get the symbolic max backedge taken count for the particular loop exit.
const SCEV *getSymbolicMax(const BasicBlock *ExitingBlock,
ScalarEvolution *SE) const;
/// Return true if the number of times this backedge is taken is either the
/// value returned by getConstantMax or zero.
bool isConstantMaxOrZero(ScalarEvolution *SE) const;

View File

@ -8223,8 +8223,9 @@ const SCEV *ScalarEvolution::getExitCount(const Loop *L,
ExitCountKind Kind) {
switch (Kind) {
case Exact:
case SymbolicMaximum:
return getBackedgeTakenInfo(L).getExact(ExitingBlock, this);
case SymbolicMaximum:
return getBackedgeTakenInfo(L).getSymbolicMax(ExitingBlock, this);
case ConstantMaximum:
return getBackedgeTakenInfo(L).getConstantMax(ExitingBlock, this);
};
@ -8556,6 +8557,12 @@ const SCEV *ScalarEvolution::BackedgeTakenInfo::getConstantMax(
return SE->getCouldNotCompute();
}
const SCEV *ScalarEvolution::BackedgeTakenInfo::getSymbolicMax(
const BasicBlock *ExitingBlock, ScalarEvolution *SE) const {
// FIXME: Need to implement this. Return exact for now.
return getExact(ExitingBlock, SE);
}
/// getConstantMax - Get the constant max backedge taken count for the loop.
const SCEV *
ScalarEvolution::BackedgeTakenInfo::getConstantMax(ScalarEvolution *SE) const {