[PATCH] D80387: [SDAG] Don't require LazyBlockFrequencyInfo at optnone
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 21 10:15:43 PDT 2020
nikic created this revision.
nikic added reviewers: yamauchi, davidxl.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
While LazyBlockFrequencyInfo itself is lazy, the dominator tree and loop info analyses it requires are not. Drop the dependency on this pass in SelectionDAGIsel at O0. This makes for a ~0.6% O0 compile-time improvement <http://llvm-compile-time-tracker.com/compare.php?from=b825062d2bd90fba922243913b2d3e3a21bb7033&to=1a15c766f907390f07a98a95e05f749ef42aac09&stat=instructions>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80387
Files:
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
test/CodeGen/AArch64/O0-pipeline.ll
test/CodeGen/X86/O0-pipeline.ll
Index: test/CodeGen/X86/O0-pipeline.ll
===================================================================
--- test/CodeGen/X86/O0-pipeline.ll
+++ test/CodeGen/X86/O0-pipeline.ll
@@ -34,10 +34,6 @@
; CHECK-NEXT: Safe Stack instrumentation pass
; CHECK-NEXT: Insert stack protectors
; CHECK-NEXT: Module Verifier
-; CHECK-NEXT: Dominator Tree Construction
-; CHECK-NEXT: Natural Loop Information
-; CHECK-NEXT: Lazy Branch Probability Analysis
-; CHECK-NEXT: Lazy Block Frequency Analysis
; CHECK-NEXT: X86 DAG->DAG Instruction Selection
; CHECK-NEXT: X86 PIC Global Base Reg Initialization
; CHECK-NEXT: Finalize ISel and expand pseudo-instructions
Index: test/CodeGen/AArch64/O0-pipeline.ll
===================================================================
--- test/CodeGen/AArch64/O0-pipeline.ll
+++ test/CodeGen/AArch64/O0-pipeline.ll
@@ -43,10 +43,6 @@
; CHECK-NEXT: Analysis for ComputingKnownBits
; CHECK-NEXT: InstructionSelect
; CHECK-NEXT: ResetMachineFunction
-; CHECK-NEXT: Dominator Tree Construction
-; CHECK-NEXT: Natural Loop Information
-; CHECK-NEXT: Lazy Branch Probability Analysis
-; CHECK-NEXT: Lazy Block Frequency Analysis
; CHECK-NEXT: AArch64 Instruction Selection
; CHECK-NEXT: Finalize ISel and expand pseudo-instructions
; CHECK-NEXT: Local Stack Slot Allocation
Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -337,7 +337,8 @@
if (UseMBPI && OptLevel != CodeGenOpt::None)
AU.addRequired<BranchProbabilityInfoWrapperPass>();
AU.addRequired<ProfileSummaryInfoWrapperPass>();
- LazyBlockFrequencyInfoPass::getLazyBFIAnalysisUsage(AU);
+ if (OptLevel != CodeGenOpt::None)
+ LazyBlockFrequencyInfoPass::getLazyBFIAnalysisUsage(AU);
MachineFunctionPass::getAnalysisUsage(AU);
}
@@ -441,9 +442,11 @@
auto *LIWP = getAnalysisIfAvailable<LoopInfoWrapperPass>();
LoopInfo *LI = LIWP ? &LIWP->getLoopInfo() : nullptr;
auto *PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
- auto *BFI = (PSI && PSI->hasProfileSummary()) ?
- &getAnalysis<LazyBlockFrequencyInfoPass>().getBFI() :
- nullptr;
+ BlockFrequencyInfo *BFI = nullptr;
+ if (PSI && PSI->hasProfileSummary()) {
+ auto *LBFI = getAnalysisIfAvailable<LazyBlockFrequencyInfoPass>();
+ BFI = LBFI ? &LBFI->getBFI() : nullptr;
+ }
LLVM_DEBUG(dbgs() << "\n\n\n=== " << Fn.getName() << "\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80387.265532.patch
Type: text/x-patch
Size: 2658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200521/258bfdb8/attachment.bin>
More information about the llvm-commits
mailing list