forked from OSchip/llvm-project
[IRCE] Avoid computing potentially unnecessary analyses. NFC
IRCE is a function pass that operates on loops. If there are no loops in the function (as seen through LI), we should avoid computing the remaining expensive analyses (such as BPI). Reordered the analyses requests and early return if there are no loops. This is an NFC with compile time improvement. The same will be done in a follow-up patch for the loop vectorizer. Reviewed-By: nikic Differential Revision: https://reviews.llvm.org/D124478
This commit is contained in:
parent
70dbb5abd3
commit
c515b2f39e
|
@ -1761,10 +1761,14 @@ IntersectUnsignedRange(ScalarEvolution &SE,
|
|||
}
|
||||
|
||||
PreservedAnalyses IRCEPass::run(Function &F, FunctionAnalysisManager &AM) {
|
||||
auto &SE = AM.getResult<ScalarEvolutionAnalysis>(F);
|
||||
auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
|
||||
auto &BPI = AM.getResult<BranchProbabilityAnalysis>(F);
|
||||
LoopInfo &LI = AM.getResult<LoopAnalysis>(F);
|
||||
// There are no loops in the function. Return before computing other expensive
|
||||
// analyses.
|
||||
if (LI.empty())
|
||||
return PreservedAnalyses::all();
|
||||
auto &SE = AM.getResult<ScalarEvolutionAnalysis>(F);
|
||||
auto &BPI = AM.getResult<BranchProbabilityAnalysis>(F);
|
||||
|
||||
// Get BFI analysis result on demand. Please note that modification of
|
||||
// CFG invalidates this analysis and we should handle it.
|
||||
|
|
Loading…
Reference in New Issue