Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[StandardInstrumentation] Annotate loops with the function name #90756

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/lib/Passes/StandardInstrumentations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ std::string getIRName(Any IR) {
return C->getName();

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

if (const auto *MF = unwrapIR<MachineFunction>(IR))
return MF->getName().str();
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Other/dump-before-after-invalidated.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
; RUN: ls %t/logs | count 1
; RUN: cat %t/logs/* | FileCheck %s --check-prefix=CHECK-CONTENTS

; CHECK-CONTENTS: ; *** IR Dump After LoopDeletionPass on bb1 (invalidated) ***
; CHECK-CONTENTS: ; *** IR Dump After LoopDeletionPass on loop %bb1 in function foo (invalidated) ***
; CHECK-CONTENTS: define void @foo() {
; CHECK-CONTENTS: br label %bb2
; CHECK-CONTENTS: bb2: ; preds = %0
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/Other/loop-pass-ordering.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
; / \ \
; loop.0.0 loop.0.1 loop.1.0
;
; CHECK: Running pass: NoOpLoopPass on loop.0.0
; CHECK: Running pass: NoOpLoopPass on loop.0.1
; CHECK: Running pass: NoOpLoopPass on loop.0
; CHECK: Running pass: NoOpLoopPass on loop.1.0
; CHECK: Running pass: NoOpLoopPass on loop.1
; CHECK: Running pass: NoOpLoopPass on loop %loop.0.0 in function f
; CHECK: Running pass: NoOpLoopPass on loop %loop.0.1 in function f
; CHECK: Running pass: NoOpLoopPass on loop %loop.0 in function f
; CHECK: Running pass: NoOpLoopPass on loop %loop.1.0 in function f
; CHECK: Running pass: NoOpLoopPass on loop %loop.1 in function f

define void @f() {
entry:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Other/loop-print-after-pass-invalidated.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
; RUN: -print-after=simple-loop-unswitch \
; RUN: | FileCheck %s

; CHECK: *** IR Dump After SimpleLoopUnswitchPass on for.cond ***
; CHECK: *** IR Dump After SimpleLoopUnswitchPass on for.cond.us ***
; CHECK: *** IR Dump After SimpleLoopUnswitchPass on loop %for.cond in function loop ***
; CHECK: *** IR Dump After SimpleLoopUnswitchPass on loop %for.cond.us in function loop ***

define void @loop(i1 %w) {
entry:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Other/loopnest-pass-ordering.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
; / \ \
; loop.0.0 loop.0.1 loop.1.0
;
; CHECK: Running pass: NoOpLoopNestPass on loop.0
; CHECK: Running pass: NoOpLoopNestPass on loop.1
; CHECK: Running pass: NoOpLoopNestPass on loop %loop.0 in function f
; CHECK: Running pass: NoOpLoopNestPass on loop %loop.1 in function f
; CHECK-NOT: Running pass: NoOpLoopNestPass on {{loop\..*\..*}}

define void @f() {
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Other/print-at-pass-number.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
; 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

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

; NUMBER: Running pass 1 LoopSimplifyPass on bar
; NUMBER-NEXT: Running pass 2 LCSSAPass on bar
; NUMBER-NEXT: Running pass 3 IndVarSimplifyPass on bb1
; NUMBER-NEXT: Running pass 4 LoopDeletionPass on bb1
; NUMBER-NEXT: Running pass 3 IndVarSimplifyPass on loop %bb1 in function bar
; NUMBER-NEXT: Running pass 4 LoopDeletionPass on loop %bb1 in function bar
; NUMBER-NEXT: Running pass 5 LoopSimplifyPass on baz
; NUMBER-NEXT: Running pass 6 LCSSAPass on baz
; NUMBER-NOT: Running pass
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopPredication/invalidate-analyses.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
; please update this test some other analysis that isn't preserved.

; CHECK: Running analysis: LazyValueAnalysis on drop_a_wc_and_leave_early
; CHECK: Running pass: LoopPredicationPass on loop
; CHECK: Running pass: LoopPredicationPass on loop %loop in function drop_a_wc_and_leave_early
; CHECK: Invalidating analysis: LazyValueAnalysis on drop_a_wc_and_leave_early
; CHECK: Running analysis: LazyValueAnalysis on drop_a_wc_and_leave
; CHECK: Running pass: LoopPredicationPass on loop
; CHECK: Running pass: LoopPredicationPass on loop %loop in function drop_a_wc_and_leave
; CHECK: Invalidating analysis: LazyValueAnalysis on drop_a_wc_and_leave


Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopRotate/pr35210.ll
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
; CHECK-NEXT: Running analysis: TargetLibraryAnalysis on f
; CHECK-NEXT: Running analysis: ScalarEvolutionAnalysis on f
; CHECK-NEXT: Running analysis: InnerAnalysisManagerProxy{{.*}} on f
; CHECK-NEXT: Running pass: LoopRotatePass on bb
; CHECK-NEXT: Running pass: LoopRotatePass on loop %bb in function f
; CHECK-NEXT: Folding loop latch bb4 into bb
; CHECK-NEXT: Invalidating analysis: PostDominatorTreeAnalysis on f
; CHECK-NEXT: Running pass: ADCEPass on f
Expand All @@ -36,7 +36,7 @@
; MSSA-NEXT: Running analysis: TargetLibraryAnalysis on f
; MSSA-NEXT: Running analysis: ScalarEvolutionAnalysis on f
; MSSA-NEXT: Running analysis: InnerAnalysisManagerProxy{{.*}} on f
; MSSA-NEXT: Running pass: LoopRotatePass on bb
; MSSA-NEXT: Running pass: LoopRotatePass on loop %bb in function f
; MSSA-NEXT: Folding loop latch bb4 into bb
; MSSA-NEXT: Invalidating analysis: PostDominatorTreeAnalysis on f
; MSSA-NEXT: Running pass: ADCEPass on f
Expand Down
16 changes: 8 additions & 8 deletions llvm/test/Transforms/LoopUnroll/revisit.ll
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ l0.0.0.ph:
l0.0.0:
%cond.0.0.0 = load volatile i1, ptr %ptr
br i1 %cond.0.0.0, label %l0.0.0, label %l0.0.1.ph
; CHECK: LoopFullUnrollPass on l0.0.0
; CHECK: LoopFullUnrollPass on loop %l0.0.0
; CHECK-NOT: LoopFullUnrollPass

l0.0.1.ph:
Expand All @@ -42,29 +42,29 @@ l0.0.1.ph:
l0.0.1:
%cond.0.0.1 = load volatile i1, ptr %ptr
br i1 %cond.0.0.1, label %l0.0.1, label %l0.0.latch
; CHECK: LoopFullUnrollPass on l0.0.1
; CHECK: LoopFullUnrollPass on loop %l0.0.1 in function full_unroll
; CHECK-NOT: LoopFullUnrollPass

l0.0.latch:
%cmp = icmp slt i32 %iv.next, 2
br i1 %cmp, label %l0.0, label %l0.latch
; CHECK: LoopFullUnrollPass on l0.0
; CHECK: LoopFullUnrollPass on loop %l0.0 in function full_unroll
; CHECK-NOT: LoopFullUnrollPass
;
; Unrolling occurs, so we visit what were the inner loops twice over. First we
; visit their clones, and then we visit the original loops re-parented.
; CHECK: LoopFullUnrollPass on l0.0.1.1
; CHECK: LoopFullUnrollPass on loop %l0.0.1.1 in function full_unroll
; CHECK-NOT: LoopFullUnrollPass
; CHECK: LoopFullUnrollPass on l0.0.0.1
; CHECK: LoopFullUnrollPass on loop %l0.0.0.1 in function full_unroll
; CHECK-NOT: LoopFullUnrollPass
; CHECK: LoopFullUnrollPass on l0.0.1
; CHECK: LoopFullUnrollPass on loop %l0.0.1 in function full_unroll
; CHECK-NOT: LoopFullUnrollPass
; CHECK: LoopFullUnrollPass on l0.0.0
; CHECK: LoopFullUnrollPass on loop %l0.0.0 in function full_unroll
; CHECK-NOT: LoopFullUnrollPass

l0.latch:
br label %l0
; CHECK: LoopFullUnrollPass on l0
; CHECK: LoopFullUnrollPass on loop %l0 in function full_unroll
; CHECK-NOT: LoopFullUnrollPass

exit:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
; SimpleLoopUnswitch not marking the Loop as removed, so we missed clearing
; the analysis caches.
;
; CHECK: Running pass: SimpleLoopUnswitchPass on loop_begin
; CHECK: Running pass: SimpleLoopUnswitchPass on loop %loop_begin in function test6
; CHECK-NEXT: Running analysis: OuterAnalysisManagerProxy
; CHECK-NEXT: Clearing all analysis results for: loop_a_inner

Expand Down
Loading