mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[SCEV] Use isa<> pattern for testing for CouldNotCompute [NFC]
Some older code - and code copied from older code - still directly tested against the singelton result of SE::getCouldNotCompute. Using the isa<SCEVCouldNotCompute> form is both shorter, and more readable.
This commit is contained in:
parent
cb9b83342f
commit
a833801813
@ -1803,7 +1803,7 @@ bool LoopAccessInfo::canAnalyzeLoop() {
|
||||
|
||||
// ScalarEvolution needs to be able to find the exit count.
|
||||
const SCEV *ExitCount = PSE->getBackedgeTakenCount();
|
||||
if (ExitCount == PSE->getSE()->getCouldNotCompute()) {
|
||||
if (isa<SCEVCouldNotCompute>(ExitCount)) {
|
||||
recordAnalysis("CantComputeNumberOfIterations")
|
||||
<< "could not determine number of loop iterations";
|
||||
LLVM_DEBUG(dbgs() << "LAA: SCEV could not compute the loop exit count.\n");
|
||||
|
@ -452,7 +452,7 @@ struct LoopInterchange {
|
||||
bool isComputableLoopNest(LoopVector LoopList) {
|
||||
for (Loop *L : LoopList) {
|
||||
const SCEV *ExitCountOuter = SE->getBackedgeTakenCount(L);
|
||||
if (ExitCountOuter == SE->getCouldNotCompute()) {
|
||||
if (isa<SCEVCouldNotCompute>(ExitCountOuter)) {
|
||||
LLVM_DEBUG(dbgs() << "Couldn't compute backedge count\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ bool LoopVersioningLICM::legalLoopStructure() {
|
||||
// We need to be able to compute the loop trip count in order
|
||||
// to generate the bound checks.
|
||||
const SCEV *ExitCount = SE->getBackedgeTakenCount(CurLoop);
|
||||
if (ExitCount == SE->getCouldNotCompute()) {
|
||||
if (isa<SCEVCouldNotCompute>(ExitCount)) {
|
||||
LLVM_DEBUG(dbgs() << " loop does not has trip count\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ static bool mustBeFiniteCountedLoop(Loop *L, ScalarEvolution *SE,
|
||||
BasicBlock *Pred) {
|
||||
// A conservative bound on the loop as a whole.
|
||||
const SCEV *MaxTrips = SE->getConstantMaxBackedgeTakenCount(L);
|
||||
if (MaxTrips != SE->getCouldNotCompute() &&
|
||||
if (!isa<SCEVCouldNotCompute>(MaxTrips) &&
|
||||
SE->getUnsignedRange(MaxTrips).getUnsignedMax().isIntN(
|
||||
CountedLoopTripWidth))
|
||||
return true;
|
||||
@ -255,7 +255,7 @@ static bool mustBeFiniteCountedLoop(Loop *L, ScalarEvolution *SE,
|
||||
// This returns an exact expression only. TODO: We really only need an
|
||||
// upper bound here, but SE doesn't expose that.
|
||||
const SCEV *MaxExec = SE->getExitCount(L, Pred);
|
||||
if (MaxExec != SE->getCouldNotCompute() &&
|
||||
if (!isa<SCEVCouldNotCompute>(MaxExec) &&
|
||||
SE->getUnsignedRange(MaxExec).getUnsignedMax().isIntN(
|
||||
CountedLoopTripWidth))
|
||||
return true;
|
||||
|
@ -2468,7 +2468,7 @@ Value *SCEVExpander::generateOverflowCheck(const SCEVAddRecExpr *AR,
|
||||
const SCEV *ExitCount =
|
||||
SE.getPredicatedBackedgeTakenCount(AR->getLoop(), Pred);
|
||||
|
||||
assert(ExitCount != SE.getCouldNotCompute() && "Invalid loop count");
|
||||
assert(!isa<SCEVCouldNotCompute>(ExitCount) && "Invalid loop count");
|
||||
|
||||
const SCEV *Step = AR->getStepRecurrence(SE);
|
||||
const SCEV *Start = AR->getStart();
|
||||
|
@ -2728,7 +2728,7 @@ Value *InnerLoopVectorizer::getOrCreateTripCount(Loop *L) {
|
||||
// Find the loop boundaries.
|
||||
ScalarEvolution *SE = PSE.getSE();
|
||||
const SCEV *BackedgeTakenCount = PSE.getBackedgeTakenCount();
|
||||
assert(BackedgeTakenCount != SE->getCouldNotCompute() &&
|
||||
assert(!isa<SCEVCouldNotCompute>(BackedgeTakenCount) &&
|
||||
"Invalid loop count");
|
||||
|
||||
Type *IdxTy = Legal->getWidestInductionType();
|
||||
@ -8274,7 +8274,7 @@ static bool processLoopInVPlanNativePath(
|
||||
OptimizationRemarkEmitter *ORE, BlockFrequencyInfo *BFI,
|
||||
ProfileSummaryInfo *PSI, LoopVectorizeHints &Hints) {
|
||||
|
||||
if (PSE.getBackedgeTakenCount() == PSE.getSE()->getCouldNotCompute()) {
|
||||
if (isa<SCEVCouldNotCompute>(PSE.getBackedgeTakenCount())) {
|
||||
LLVM_DEBUG(dbgs() << "LV: cannot compute the outer-loop trip count\n");
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user