Skip to content

Commit 46c2d93

Browse files
authored
[StandardInstrumentation] Annotate loops with the function name (#90756)
When analyzing pass debug output it is helpful to have the function name along with the loop name.
1 parent a8fbe50 commit 46c2d93

File tree

10 files changed

+28
-27
lines changed

10 files changed

+28
-27
lines changed

llvm/lib/Passes/StandardInstrumentations.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ std::string getIRName(Any IR) {
245245
return C->getName();
246246

247247
if (const auto *L = unwrapIR<Loop>(IR))
248-
return L->getName().str();
248+
return "loop %" + L->getName().str() + " in function " +
249+
L->getHeader()->getParent()->getName().str();
249250

250251
if (const auto *MF = unwrapIR<MachineFunction>(IR))
251252
return MF->getName().str();

llvm/test/Other/dump-before-after-invalidated.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
; RUN: ls %t/logs | count 1
88
; RUN: cat %t/logs/* | FileCheck %s --check-prefix=CHECK-CONTENTS
99

10-
; CHECK-CONTENTS: ; *** IR Dump After LoopDeletionPass on bb1 (invalidated) ***
10+
; CHECK-CONTENTS: ; *** IR Dump After LoopDeletionPass on loop %bb1 in function foo (invalidated) ***
1111
; CHECK-CONTENTS: define void @foo() {
1212
; CHECK-CONTENTS: br label %bb2
1313
; CHECK-CONTENTS: bb2: ; preds = %0

llvm/test/Other/loop-pass-ordering.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
; / \ \
99
; loop.0.0 loop.0.1 loop.1.0
1010
;
11-
; CHECK: Running pass: NoOpLoopPass on loop.0.0
12-
; CHECK: Running pass: NoOpLoopPass on loop.0.1
13-
; CHECK: Running pass: NoOpLoopPass on loop.0
14-
; CHECK: Running pass: NoOpLoopPass on loop.1.0
15-
; CHECK: Running pass: NoOpLoopPass on loop.1
11+
; CHECK: Running pass: NoOpLoopPass on loop %loop.0.0 in function f
12+
; CHECK: Running pass: NoOpLoopPass on loop %loop.0.1 in function f
13+
; CHECK: Running pass: NoOpLoopPass on loop %loop.0 in function f
14+
; CHECK: Running pass: NoOpLoopPass on loop %loop.1.0 in function f
15+
; CHECK: Running pass: NoOpLoopPass on loop %loop.1 in function f
1616

1717
define void @f() {
1818
entry:

llvm/test/Other/loop-print-after-pass-invalidated.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
; RUN: -print-after=simple-loop-unswitch \
44
; RUN: | FileCheck %s
55

6-
; CHECK: *** IR Dump After SimpleLoopUnswitchPass on for.cond ***
7-
; CHECK: *** IR Dump After SimpleLoopUnswitchPass on for.cond.us ***
6+
; CHECK: *** IR Dump After SimpleLoopUnswitchPass on loop %for.cond in function loop ***
7+
; CHECK: *** IR Dump After SimpleLoopUnswitchPass on loop %for.cond.us in function loop ***
88

99
define void @loop(i1 %w) {
1010
entry:

llvm/test/Other/loopnest-pass-ordering.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
; / \ \
99
; loop.0.0 loop.0.1 loop.1.0
1010
;
11-
; CHECK: Running pass: NoOpLoopNestPass on loop.0
12-
; CHECK: Running pass: NoOpLoopNestPass on loop.1
11+
; CHECK: Running pass: NoOpLoopNestPass on loop %loop.0 in function f
12+
; CHECK: Running pass: NoOpLoopNestPass on loop %loop.1 in function f
1313
; CHECK-NOT: Running pass: NoOpLoopNestPass on {{loop\..*\..*}}
1414

1515
define void @f() {

llvm/test/Other/print-at-pass-number.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
; RUN: opt -passes="loop(indvars,loop-deletion,loop-unroll-full)" -print-module-scope -print-after-pass-number=2 -S -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=AFTER
55

66
define i32 @bar(i32 %arg) {
7-
; BEFORE: *** IR Dump Before 3-IndVarSimplifyPass on bb1 ***
7+
; BEFORE: *** IR Dump Before 3-IndVarSimplifyPass on loop %bb1 in function bar ***
88
; BEFORE: define i32 @bar(i32 %arg) {
99
; AFTER: *** IR Dump After 2-LCSSAPass on bar ***
1010
; AFTER: define i32 @bar(i32 %arg) {
@@ -30,8 +30,8 @@ define i32 @baz(i32 %arg) {
3030

3131
; NUMBER: Running pass 1 LoopSimplifyPass on bar
3232
; NUMBER-NEXT: Running pass 2 LCSSAPass on bar
33-
; NUMBER-NEXT: Running pass 3 IndVarSimplifyPass on bb1
34-
; NUMBER-NEXT: Running pass 4 LoopDeletionPass on bb1
33+
; NUMBER-NEXT: Running pass 3 IndVarSimplifyPass on loop %bb1 in function bar
34+
; NUMBER-NEXT: Running pass 4 LoopDeletionPass on loop %bb1 in function bar
3535
; NUMBER-NEXT: Running pass 5 LoopSimplifyPass on baz
3636
; NUMBER-NEXT: Running pass 6 LCSSAPass on baz
3737
; NUMBER-NOT: Running pass

llvm/test/Transforms/LoopPredication/invalidate-analyses.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
; please update this test some other analysis that isn't preserved.
66

77
; CHECK: Running analysis: LazyValueAnalysis on drop_a_wc_and_leave_early
8-
; CHECK: Running pass: LoopPredicationPass on loop
8+
; CHECK: Running pass: LoopPredicationPass on loop %loop in function drop_a_wc_and_leave_early
99
; CHECK: Invalidating analysis: LazyValueAnalysis on drop_a_wc_and_leave_early
1010
; CHECK: Running analysis: LazyValueAnalysis on drop_a_wc_and_leave
11-
; CHECK: Running pass: LoopPredicationPass on loop
11+
; CHECK: Running pass: LoopPredicationPass on loop %loop in function drop_a_wc_and_leave
1212
; CHECK: Invalidating analysis: LazyValueAnalysis on drop_a_wc_and_leave
1313

1414

llvm/test/Transforms/LoopRotate/pr35210.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
; CHECK-NEXT: Running analysis: TargetLibraryAnalysis on f
1818
; CHECK-NEXT: Running analysis: ScalarEvolutionAnalysis on f
1919
; CHECK-NEXT: Running analysis: InnerAnalysisManagerProxy{{.*}} on f
20-
; CHECK-NEXT: Running pass: LoopRotatePass on bb
20+
; CHECK-NEXT: Running pass: LoopRotatePass on loop %bb in function f
2121
; CHECK-NEXT: Folding loop latch bb4 into bb
2222
; CHECK-NEXT: Invalidating analysis: PostDominatorTreeAnalysis on f
2323
; CHECK-NEXT: Running pass: ADCEPass on f
@@ -36,7 +36,7 @@
3636
; MSSA-NEXT: Running analysis: TargetLibraryAnalysis on f
3737
; MSSA-NEXT: Running analysis: ScalarEvolutionAnalysis on f
3838
; MSSA-NEXT: Running analysis: InnerAnalysisManagerProxy{{.*}} on f
39-
; MSSA-NEXT: Running pass: LoopRotatePass on bb
39+
; MSSA-NEXT: Running pass: LoopRotatePass on loop %bb in function f
4040
; MSSA-NEXT: Folding loop latch bb4 into bb
4141
; MSSA-NEXT: Invalidating analysis: PostDominatorTreeAnalysis on f
4242
; MSSA-NEXT: Running pass: ADCEPass on f

llvm/test/Transforms/LoopUnroll/revisit.ll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ l0.0.0.ph:
3333
l0.0.0:
3434
%cond.0.0.0 = load volatile i1, ptr %ptr
3535
br i1 %cond.0.0.0, label %l0.0.0, label %l0.0.1.ph
36-
; CHECK: LoopFullUnrollPass on l0.0.0
36+
; CHECK: LoopFullUnrollPass on loop %l0.0.0
3737
; CHECK-NOT: LoopFullUnrollPass
3838

3939
l0.0.1.ph:
@@ -42,29 +42,29 @@ l0.0.1.ph:
4242
l0.0.1:
4343
%cond.0.0.1 = load volatile i1, ptr %ptr
4444
br i1 %cond.0.0.1, label %l0.0.1, label %l0.0.latch
45-
; CHECK: LoopFullUnrollPass on l0.0.1
45+
; CHECK: LoopFullUnrollPass on loop %l0.0.1 in function full_unroll
4646
; CHECK-NOT: LoopFullUnrollPass
4747

4848
l0.0.latch:
4949
%cmp = icmp slt i32 %iv.next, 2
5050
br i1 %cmp, label %l0.0, label %l0.latch
51-
; CHECK: LoopFullUnrollPass on l0.0
51+
; CHECK: LoopFullUnrollPass on loop %l0.0 in function full_unroll
5252
; CHECK-NOT: LoopFullUnrollPass
5353
;
5454
; Unrolling occurs, so we visit what were the inner loops twice over. First we
5555
; visit their clones, and then we visit the original loops re-parented.
56-
; CHECK: LoopFullUnrollPass on l0.0.1.1
56+
; CHECK: LoopFullUnrollPass on loop %l0.0.1.1 in function full_unroll
5757
; CHECK-NOT: LoopFullUnrollPass
58-
; CHECK: LoopFullUnrollPass on l0.0.0.1
58+
; CHECK: LoopFullUnrollPass on loop %l0.0.0.1 in function full_unroll
5959
; CHECK-NOT: LoopFullUnrollPass
60-
; CHECK: LoopFullUnrollPass on l0.0.1
60+
; CHECK: LoopFullUnrollPass on loop %l0.0.1 in function full_unroll
6161
; CHECK-NOT: LoopFullUnrollPass
62-
; CHECK: LoopFullUnrollPass on l0.0.0
62+
; CHECK: LoopFullUnrollPass on loop %l0.0.0 in function full_unroll
6363
; CHECK-NOT: LoopFullUnrollPass
6464

6565
l0.latch:
6666
br label %l0
67-
; CHECK: LoopFullUnrollPass on l0
67+
; CHECK: LoopFullUnrollPass on loop %l0 in function full_unroll
6868
; CHECK-NOT: LoopFullUnrollPass
6969

7070
exit:

llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-markloopasdeleted.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
; SimpleLoopUnswitch not marking the Loop as removed, so we missed clearing
1818
; the analysis caches.
1919
;
20-
; CHECK: Running pass: SimpleLoopUnswitchPass on loop_begin
20+
; CHECK: Running pass: SimpleLoopUnswitchPass on loop %loop_begin in function test6
2121
; CHECK-NEXT: Running analysis: OuterAnalysisManagerProxy
2222
; CHECK-NEXT: Clearing all analysis results for: loop_a_inner
2323

0 commit comments

Comments
 (0)