[llvm] [LoopInfo][NewPM] Print function name in LoopPrinterPass (PR #76527)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 28 11:12:57 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Björn Pettersson (bjope)
<details>
<summary>Changes</summary>
The legacy pass manager printed the function name when printing loop info (via -analyze option). Like this:
Printing analysis 'Natural Loop Information' for function 'func': Loop at depth 1 containing: ...
Loop at depth 2 containing: ...
Make sure we print that first line including the function name also when using the new pass manager version of LoopPrinterPass.
This was requested in
https://discourse.llvm.org/t/need-usage-help-w-new-pass-manager-for-opt-analysis-natural-loop-information/75874/7
---
Full diff: https://github.com/llvm/llvm-project/pull/76527.diff
2 Files Affected:
- (modified) llvm/lib/Analysis/LoopInfo.cpp (+2)
- (modified) llvm/test/Analysis/LoopInfo/annotated-parallel-simple.ll (+2-2)
``````````diff
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index 87ddfe3e92ae9a..e847d8afa7048f 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -969,6 +969,8 @@ LoopInfo LoopAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
PreservedAnalyses LoopPrinterPass::run(Function &F,
FunctionAnalysisManager &AM) {
+ OS << "Printing analysis 'Natural Loop Information' for function '"
+ << F.getName() << "':\n";
AM.getResult<LoopAnalysis>(F).print(OS);
return PreservedAnalyses::all();
}
diff --git a/llvm/test/Analysis/LoopInfo/annotated-parallel-simple.ll b/llvm/test/Analysis/LoopInfo/annotated-parallel-simple.ll
index d96ff492c53a76..39d2ba8c16c589 100644
--- a/llvm/test/Analysis/LoopInfo/annotated-parallel-simple.ll
+++ b/llvm/test/Analysis/LoopInfo/annotated-parallel-simple.ll
@@ -33,5 +33,5 @@ for.end:
!7 = distinct !{!7, !9} ; LoopID
!9 = !{!"llvm.loop.parallel_accesses", !6}
-
-; CHECK: Parallel Loop
+; CHECK: Printing analysis 'Natural Loop Information' for function 'func':
+; CHECK: Parallel Loop at depth 1 containing:
``````````
</details>
https://github.com/llvm/llvm-project/pull/76527
More information about the llvm-commits
mailing list