Skip to content

Commit

Permalink
[StandardInstrumentation] Annotate loops with the function name
Browse files Browse the repository at this point in the history
When analyzing pass debug output it is helpful to have the function name
along with the loop name.
  • Loading branch information
annamthomas committed May 2, 2024
1 parent cf2f32c commit 396f48f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
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
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
; 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
; 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

0 comments on commit 396f48f

Please sign in to comment.