Skip to content

Commit cf06047

Browse files
committed
[LV] Remove AddedAnyChecks, check directly instead (NFC).
As suggested in #143879, remove AddedAnyChecks member and directly check if there are any relevant runtime check blocks.
1 parent 1828381 commit cf06047

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,9 +1778,6 @@ class GeneratedRTChecks {
17781778
/// If it is nullptr no memory runtime checks have been generated.
17791779
Value *MemRuntimeCheckCond = nullptr;
17801780

1781-
/// True if any checks have been added.
1782-
bool AddedAnyChecks = false;
1783-
17841781
DominatorTree *DT;
17851782
LoopInfo *LI;
17861783
TargetTransformInfo *TTI;
@@ -2044,7 +2041,6 @@ class GeneratedRTChecks {
20442041
if (AddBranchWeights)
20452042
setBranchWeights(BI, SCEVCheckBypassWeights, /*IsExpected=*/false);
20462043
ReplaceInstWithInst(SCEVCheckBlock->getTerminator(), &BI);
2047-
AddedAnyChecks = true;
20482044
return SCEVCheckBlock;
20492045
}
20502046

@@ -2072,12 +2068,15 @@ class GeneratedRTChecks {
20722068
MemCheckBlock->getTerminator()->setDebugLoc(
20732069
Pred->getTerminator()->getDebugLoc());
20742070

2075-
AddedAnyChecks = true;
20762071
return MemCheckBlock;
20772072
}
20782073

20792074
/// Return true if any runtime checks have been added
2080-
bool hasChecks() const { return AddedAnyChecks; }
2075+
bool hasChecks() const {
2076+
using namespace llvm::PatternMatch;
2077+
return (SCEVCheckCond && !match(SCEVCheckCond, m_ZeroInt())) ||
2078+
MemRuntimeCheckCond;
2079+
}
20812080
};
20822081
} // namespace
20832082

0 commit comments

Comments
 (0)