Skip to content

Commit 5cabc69

Browse files
committed
Address review comments for the new tests
Also tweak more pass manager tests to make them pass.
1 parent 5d46226 commit 5cabc69

8 files changed

+44
-27
lines changed

llvm/lib/CodeGen/TargetPassConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ void TargetPassConfig::addIRPasses() {
871871
// passes since it emits those kinds of intrinsics.
872872
addPass(createExpandVectorPredicationPass());
873873

874-
// TODO: comment
874+
// Instrument function entry after all inlining.
875875
addPass(createPostInlineEntryExitInstrumenterPass());
876876

877877
// Add scalarization of target's unsupported masked memory intrinsics pass.

llvm/test/CodeGen/X86/instrument-function-inlined.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
define void @leaf_function() #0 {
1111
; CHECK-LABEL: leaf_function:
1212
; CHECK: callq __cyg_profile_func_enter_bare
13-
; CHECK: movq leaf_function@GOTPCREL(%rip), %rdi
13+
; CHECK: {{.*}} %rdi
1414
; CHECK-NEXT: callq __cyg_profile_func_exit
1515
ret void
1616
}
@@ -20,7 +20,7 @@ entry:
2020
; CHECK-LABEL: root_function:
2121
; CHECK: callq __cyg_profile_func_enter_bare
2222
; CHECK-NEXT: callq leaf_function
23-
; CHECK: movq root_function@GOTPCREL(%rip), %rdi
23+
; CHECK: {{.*}} %rdi
2424
; CHECK-NEXT: callq __cyg_profile_func_exit
2525
call void @leaf_function()
2626
ret void

llvm/test/Other/new-pass-manager.ll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,9 @@
290290
; RUN: opt -disable-output -disable-verify -verify-analysis-invalidation=0 -debug-pass-manager \
291291
; RUN: -passes='default<O0>' %s 2>&1 \
292292
; RUN: | FileCheck %s --check-prefix=CHECK-O0 --check-prefix=%llvmcheckext
293-
; CHECK-O0: Running pass: AlwaysInlinerPass
294-
; CHECK-O0-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}>
293+
; CHECK-O0: Running analysis: InnerAnalysisManagerProxy<{{.*}}>
294+
; CHECK-O0-NEXT: Running pass: EntryExitInstrumenterPass
295+
; CHECK-O0-NEXT: Running pass: AlwaysInlinerPass
295296
; CHECK-O0-NEXT: Running analysis: ProfileSummaryAnalysis
296297
; CHECK-EXT-NEXT: Running pass: {{.*}}Bye
297298
; We don't have checks for CHECK-NOEXT here, but this simplifies the test, while

llvm/test/Other/new-pm-O0-defaults.ll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-LTO
3131

3232
; CHECK-DIS: Running analysis: InnerAnalysisManagerProxy
33+
; CHECK-DIS-NEXT: Running pass: EntryExitInstrumenterPass
3334
; CHECK-DIS-NEXT: Running pass: AddDiscriminatorsPass
3435
; CHECK-DIS-NEXT: Running pass: AlwaysInlinerPass
3536
; CHECK-DIS-NEXT: Running analysis: ProfileSummaryAnalysis
3637
; CHECK-DEFAULT: Running analysis: InnerAnalysisManagerProxy
37-
; CHECK-PRE-LINK: Running pass: EntryExitInstrumenterPass
38-
; CHECK-PRE-LINK-NEXT: Running pass: AlwaysInlinerPass
38+
; CHECK-DEFAULT-NEXT: Running pass: EntryExitInstrumenterPass
39+
; CHECK-DEFAULT-NEXT: Running pass: AlwaysInlinerPass
3940
; CHECK-DEFAULT-NEXT: Running analysis: ProfileSummaryAnalysis
4041
; CHECK-MATRIX: Running pass: LowerMatrixIntrinsicsPass
4142
; CHECK-MATRIX-NEXT: Running analysis: TargetIRAnalysis

llvm/test/Other/new-pm-defaults.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@
9797
; CHECK-O: Running pass: Annotation2Metadata
9898
; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
9999
; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass
100-
; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
101100
; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
101+
; CHECK-O-NEXT: Running pass: EntryExitInstrumenterPass
102+
; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
102103
; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
103104
; CHECK-O-NEXT: Running pass: CoroEarlyPass
104105
; CHECK-O-NEXT: Running pass: LowerExpectIntrinsicPass

llvm/test/Other/new-pm-thinlto-prelink-defaults.ll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,14 @@
6161
; Suppress FileCheck --allow-unused-prefixes=false diagnostics.
6262
; CHECK-NOEXT: {{^}}
6363

64-
; CHECK-O: Running pass: Annotation2Metadata
64+
; CHECK-O: Running pass: Annotation2MetadataPass
6565
; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
6666
; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass
6767
; CHECK-DIS-NEXT: Running analysis: InnerAnalysisManagerProxy
6868
; CHECK-DIS-NEXT: Running pass: AddDiscriminatorsPass
69-
; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
7069
; CHECK-O-NODIS-NEXT: Running analysis: InnerAnalysisManagerProxy
70+
; CHECK-O-NEXT: Running pass: EntryExitInstrumenterPass
71+
; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
7172
; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
7273
; CHECK-O-NEXT: Running pass: CoroEarlyPass
7374
; CHECK-O-NEXT: Running pass: LowerExpectIntrinsicPass

llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
3131
; CHECK-O-NEXT: Running pass: AddDiscriminatorsPass
3232
; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass
33+
; CHECK-O-NEXT: Running pass: EntryExitInstrumenterPass
3334
; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
3435
; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
3536
; CHECK-O-NEXT: Running pass: CoroEarlyPass
Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
1-
; RUN: opt -passes="default<O1>" -S < %s | FileCheck %s
2-
; RUN: opt -passes="thinlto-pre-link<O2>" -S < %s | FileCheck %s
3-
; RUN: opt -passes="thinlto-pre-link<O2>,thinlto<O3>" -S < %s | FileCheck %s
1+
; RUN: opt -passes="default<O1>" -S < %s | FileCheck -check-prefix=PRELTO %s
2+
; RUN: opt -passes="thinlto-pre-link<O0>,thinlto<O0>" -S < %s | FileCheck -check-prefix=PRELTO %s
3+
; RUN: opt -passes="thinlto-pre-link<O2>" -S < %s | FileCheck -check-prefix=PRELTO %s
4+
; RUN: opt -passes="thinlto<O2>" -S < %s | FileCheck -check-prefix=LTO %s
5+
; RUN: opt -passes="lto<O2>" -S < %s | FileCheck -check-prefix=LTO %s
6+
7+
; Pre-inline instrumentation should be inserted, but not by LTO/ThinLTO passes.
48

59
target triple = "x86_64-unknown-linux"
610

711
define void @leaf_function() #0 {
812
entry:
913
ret void
10-
; CHECK-LABEL: entry:
11-
; CHECK-NEXT: %0 = tail call ptr @llvm.returnaddress(i32 0)
12-
; CHECK-NEXT: tail call void @__cyg_profile_func_enter(ptr nonnull @leaf_function, ptr %0)
13-
; CHECK-NEXT: tail call void @__cyg_profile_func_exit(ptr nonnull @leaf_function, ptr %0)
14-
; CHECK-NEXT: ret void
14+
; PRELTO-LABEL: entry:
15+
; PRELTO-NEXT: %0 ={{( tail)?}} call ptr @llvm.returnaddress(i32 0)
16+
; PRELTO-NEXT: {{( tail)? call void @__cyg_profile_func_enter\(ptr( nonnull)? @leaf_function, ptr %0\)}}
17+
; LTO-NOT: {{( tail)?}} call void @__cyg_profile_func_enter
18+
; PRELTO: {{( tail)?}} call void @__cyg_profile_func_exit
19+
; PRELTO-NEXT: ret void
20+
; LTO-NOT: {{( tail)?}} call void @__cyg_profile_func_exit
21+
; LTO-LABEL: entry:
22+
; LTO-NEXT: ret void
1523
}
1624

1725

18-
define void @root_function() #0 {
26+
define void @root_function() #1 {
1927
entry:
2028
call void @leaf_function()
2129
ret void
22-
; CHECK-LABEL: entry:
23-
; CHECK-NEXT: %0 = tail call ptr @llvm.returnaddress(i32 0)
24-
; CHECK-NEXT: tail call void @__cyg_profile_func_enter(ptr nonnull @root_function, ptr %0)
25-
; CHECK-NEXT: tail call void @__cyg_profile_func_enter(ptr nonnull @leaf_function, ptr %0)
26-
; CHECK-NEXT: tail call void @__cyg_profile_func_exit(ptr nonnull @leaf_function, ptr %0)
27-
; CHECK-NEXT: tail call void @__cyg_profile_func_exit(ptr nonnull @root_function, ptr %0)
28-
; CHECK-NEXT: ret void
30+
; PRELTO-LABEL: entry:
31+
; PRELTO-NEXT: %0 ={{( tail)?}} call ptr @llvm.returnaddress(i32 0)
32+
; PRELTO-NEXT: {{( tail)?}} call void @__cyg_profile_func_enter(ptr{{( nonnull)?}} @root_function, ptr %0)
33+
; PRELTO: {{( tail)?}} call void @__cyg_profile_func_enter
34+
; PRELTO: {{( tail)?}} call void @__cyg_profile_func_exit
35+
; PRELTO: {{( tail)?}} call void @__cyg_profile_func_exit
36+
; PRELTO-NEXT: ret void
37+
; LTO-LABEL: entry:
38+
; LTO-NEXT: ret void
39+
; LTO-NOT: {{( tail)?}} call void @__cyg_profile_func_exit
2940
}
3041

31-
attributes #0 = { "instrument-function-entry"="__cyg_profile_func_enter" "instrument-function-exit"="__cyg_profile_func_exit" }
42+
attributes #0 = { alwaysinline "instrument-function-entry"="__cyg_profile_func_enter" "instrument-function-exit"="__cyg_profile_func_exit" }
43+
attributes #1 = { "instrument-function-entry"="__cyg_profile_func_enter" "instrument-function-exit"="__cyg_profile_func_exit" }

0 commit comments

Comments
 (0)