[llvm] 7dc0ba9 - [LoopInfo][NewPM] Print function name in LoopPrinterPass (#76527)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 3 04:49:17 PST 2024
Author: Björn Pettersson
Date: 2024-01-03T13:49:13+01:00
New Revision: 7dc0ba949c1527808b7ceea58bdd72c9f3e2e300
URL: https://github.com/llvm/llvm-project/commit/7dc0ba949c1527808b7ceea58bdd72c9f3e2e300
DIFF: https://github.com/llvm/llvm-project/commit/7dc0ba949c1527808b7ceea58bdd72c9f3e2e300.diff
LOG: [LoopInfo][NewPM] Print function name in LoopPrinterPass (#76527)
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 such a first line including the function name
also when using the new pass manager version of LoopPrinterPass.
The format of the string is changed slightly, so now we say:
Loop info for function 'func':
Loop at depth 1 containing: ...
Loop at depth 2 containing: ...
This was originally requested in
https://discourse.llvm.org/t/need-usage-help-w-new-pass-manager-for-opt-analysis-natural-loop-information/75874/7
and also mentioned in
https://github.com/llvm/llvm-project/issues/76762
Added:
Modified:
llvm/lib/Analysis/LoopInfo.cpp
llvm/test/Analysis/LoopInfo/annotated-parallel-simple.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index 87ddfe3e92ae9a..59c96a3371e87a 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -969,7 +969,9 @@ LoopInfo LoopAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
PreservedAnalyses LoopPrinterPass::run(Function &F,
FunctionAnalysisManager &AM) {
- AM.getResult<LoopAnalysis>(F).print(OS);
+ auto &LI = AM.getResult<LoopAnalysis>(F);
+ OS << "Loop info for function '" << F.getName() << "':\n";
+ LI.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..24ed59c49ccc24 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: Loop info for function 'func':
+; CHECK: Parallel Loop at depth 1 containing:
More information about the llvm-commits
mailing list