Skip to content

Commit cab81dd

Browse files
authored
[EntryExitInstrumenter] Move passes out of clang into LLVM default pipelines (#92171)
Move EntryExitInstrumenter(PostInlining=true) to as late as possible and EntryExitInstrumenter(PostInlining=false) to an early pre-inlining stage (but skip for ThinLTO post-link). This should fix the issues reported in rust-lang/rust#92109 and #52853. These are caused by https://reviews.llvm.org/D97608.
1 parent 6119340 commit cab81dd

36 files changed

+268
-162
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
#include "llvm/Transforms/Scalar/GVN.h"
8686
#include "llvm/Transforms/Scalar/JumpThreading.h"
8787
#include "llvm/Transforms/Utils/Debugify.h"
88-
#include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
8988
#include "llvm/Transforms/Utils/ModuleUtils.h"
9089
#include <memory>
9190
#include <optional>
@@ -983,22 +982,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
983982
/*DropTypeTests=*/true));
984983
});
985984

986-
if (CodeGenOpts.InstrumentFunctions ||
987-
CodeGenOpts.InstrumentFunctionEntryBare ||
988-
CodeGenOpts.InstrumentFunctionsAfterInlining ||
989-
CodeGenOpts.InstrumentForProfiling) {
990-
PB.registerPipelineStartEPCallback(
991-
[](ModulePassManager &MPM, OptimizationLevel Level) {
992-
MPM.addPass(createModuleToFunctionPassAdaptor(
993-
EntryExitInstrumenterPass(/*PostInlining=*/false)));
994-
});
995-
PB.registerOptimizerLastEPCallback(
996-
[](ModulePassManager &MPM, OptimizationLevel Level) {
997-
MPM.addPass(createModuleToFunctionPassAdaptor(
998-
EntryExitInstrumenterPass(/*PostInlining=*/true)));
999-
});
1000-
}
1001-
1002985
// Register callbacks to schedule sanitizer passes at the appropriate part
1003986
// of the pipeline.
1004987
if (LangOpts.Sanitize.has(SanitizerKind::LocalBounds))
Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
11
// REQUIRES: x86-registered-target
2-
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finstrument-functions -O0 -o - -emit-llvm %s | FileCheck %s
3-
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finstrument-functions -O2 -o - -emit-llvm %s | FileCheck %s
4-
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finstrument-functions-after-inlining -O2 -o - -emit-llvm %s | FileCheck -check-prefix=NOINLINE %s
2+
// RUN: %clang_cc1 -disable-llvm-passes -triple x86_64-unknown-unknown -finstrument-functions -O0 -o - -emit-llvm %s | FileCheck %s
3+
// RUN: %clang_cc1 -disable-llvm-passes -triple x86_64-unknown-unknown -finstrument-functions -O2 -o - -emit-llvm %s | FileCheck %s
4+
// RUN: %clang_cc1 -disable-llvm-passes -triple x86_64-unknown-unknown -finstrument-functions-after-inlining -O2 -o - -emit-llvm %s | FileCheck -check-prefix=NOINLINE %s
55

66
__attribute__((always_inline)) int leaf(int x) {
77
return x;
8-
// CHECK-LABEL: define {{.*}} @leaf
9-
// CHECK: call void @__cyg_profile_func_enter
10-
// CHECK-NOT: cyg_profile
11-
// CHECK: call void @__cyg_profile_func_exit
12-
// CHECK-NOT: cyg_profile
13-
// CHECK: ret
8+
// CHECK-LABEL: define {{.*}} @leaf(i32 noundef %x) #0 {
149
}
1510

1611
int root(int x) {
1712
return leaf(x);
18-
// CHECK-LABEL: define {{.*}} @root
19-
// CHECK: call void @__cyg_profile_func_enter
20-
// CHECK-NOT: cyg_profile
21-
22-
// Inlined from leaf():
23-
// CHECK: call void @__cyg_profile_func_enter
24-
// CHECK-NOT: cyg_profile
25-
// CHECK: call void @__cyg_profile_func_exit
26-
// CHECK-NOT: cyg_profile
27-
28-
// CHECK: call void @__cyg_profile_func_exit
29-
// CHECK: ret
30-
31-
// NOINLINE-LABEL: define {{.*}} @root
32-
// NOINLINE: call void @__cyg_profile_func_enter
33-
// NOINLINE-NOT: cyg_profile
34-
// NOINLINE: call void @__cyg_profile_func_exit
35-
// NOINLINE-NOT: cyg_profile
36-
// NOINLINE: ret
13+
// CHECK-LABEL: define {{.*}} @root(i32 noundef %x) #1 {
14+
// NOINLINE-LABEL: define {{.*}} @root(i32 noundef %x) #1 {
3715
}
16+
17+
// CHECK: attributes #0 = { {{.*}}"instrument-function-entry"="__cyg_profile_func_enter" "instrument-function-exit"="__cyg_profile_func_exit"
18+
// CHECK: attributes #1 = { {{.*}}"instrument-function-entry"="__cyg_profile_func_enter" "instrument-function-exit"="__cyg_profile_func_exit"
19+
// NOINLINE: attributes #0 = { {{.*}}"instrument-function-entry-inlined"="__cyg_profile_func_enter" "instrument-function-exit-inlined"="__cyg_profile_func_exit"
20+
// NOINLINE: attributes #1 = { {{.*}}"instrument-function-entry-inlined"="__cyg_profile_func_enter" "instrument-function-exit-inlined"="__cyg_profile_func_exit"
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
1-
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions | FileCheck %s
2-
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-function-entry-bare | FileCheck -check-prefix=BARE %s
1+
// RUN: %clang_cc1 -disable-llvm-passes -triple x86_64-apple-darwin10 -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions | FileCheck -check-prefix=PREINLINE %s
2+
// RUN: %clang_cc1 -disable-llvm-passes -triple x86_64-apple-darwin10 -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-function-entry-bare | FileCheck -check-prefix=BARE %s
33

44
@interface ObjCClass
55
@end
66

77
@implementation ObjCClass
88

9-
// CHECK: @"\01+[ObjCClass initialize]"
10-
// CHECK: call void @__cyg_profile_func_enter
11-
// CHECK: call void @__cyg_profile_func_exit
12-
// BARE: @"\01+[ObjCClass initialize]"
13-
// BARE: call void @__cyg_profile_func_enter
9+
// PREINLINE: @"\01+[ObjCClass initialize]"{{\(.*\)}} #0
10+
// BARE: @"\01+[ObjCClass initialize]"{{\(.*\)}} #0
1411
+ (void)initialize {
1512
}
1613

17-
// CHECK: @"\01+[ObjCClass load]"
18-
// CHECK-NOT: call void @__cyg_profile_func_enter
19-
// BARE: @"\01+[ObjCClass load]"
20-
// BARE-NOT: call void @__cyg_profile_func_enter
14+
// PREINLINE: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
15+
// BARE: @"\01+[ObjCClass load]"{{\(.*\)}} #2
2116
+ (void)load __attribute__((no_instrument_function)) {
2217
}
2318

24-
// CHECK: @"\01-[ObjCClass dealloc]"
25-
// CHECK-NOT: call void @__cyg_profile_func_enter
26-
// BARE: @"\01-[ObjCClass dealloc]"
27-
// BARE-NOT: call void @__cyg_profile_func_enter
19+
// PREINLINE: @"\01-[ObjCClass dealloc]"{{\(.*\)}} #2
20+
// BARE: @"\01-[ObjCClass dealloc]"{{\(.*\)}} #2
2821
- (void)dealloc __attribute__((no_instrument_function)) {
2922
}
3023

31-
// CHECK: declare void @__cyg_profile_func_enter(ptr, ptr)
32-
// CHECK: declare void @__cyg_profile_func_exit(ptr, ptr)
33-
// BARE: declare void @__cyg_profile_func_enter_bare
24+
// PREINLINE: attributes #0 = { {{.*}}"instrument-function-entry"="__cyg_profile_func_enter"
25+
// PREINLINE-NOT: attributes #0 = { {{.*}}"instrument-function-entry"="__cyg_profile_func_enter_bare"
26+
// PREINLINE-NOT: attributes #2 = { {{.*}}"__cyg_profile_func_enter"
27+
// BARE: attributes #0 = { {{.*}}"instrument-function-entry-inlined"="__cyg_profile_func_enter_bare"
28+
// BARE-NOT: attributes #0 = { {{.*}}"__cyg_profile_func_enter"
29+
// BARE-NOT: attributes #2 = { {{.*}}"__cyg_profile_func_enter_bare"
3430
@end

clang/test/CodeGen/lto-newpm-pipeline.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727

2828
// CHECK-FULL-O0: Running pass: VerifierPass
2929
// CHECK-FULL-O0-NEXT: Running analysis: VerifierAnalysis
30-
// CHECK-FULL-O0-NEXT: Running pass: AlwaysInlinerPass
3130
// CHECK-FULL-O0-NEXT: Running analysis: InnerAnalysisManagerProxy
31+
// CHECK-FULL-O0-NEXT: Running pass: EntryExitInstrumenterPass
32+
// CHECK-FULL-O0-NEXT: Running pass: AlwaysInlinerPass
3233
// CHECK-FULL-O0-NEXT: Running analysis: ProfileSummaryAnalysis
3334
// CHECK-FULL-O0-NEXT: Running pass: CoroConditionalWrapper
3435
// CHECK-FULL-O0-NEXT: Running pass: CanonicalizeAliasesPass
@@ -40,8 +41,9 @@
4041

4142
// CHECK-THIN-O0: Running pass: VerifierPass
4243
// CHECK-THIN-O0-NEXT: Running analysis: VerifierAnalysis
43-
// CHECK-THIN-O0-NEXT: Running pass: AlwaysInlinerPass
4444
// CHECK-THIN-O0-NEXT: Running analysis: InnerAnalysisManagerProxy
45+
// CHECK-THIN-O0-NEXT: Running pass: EntryExitInstrumenterPass
46+
// CHECK-THIN-O0-NEXT: Running pass: AlwaysInlinerPass
4547
// CHECK-THIN-O0-NEXT: Running analysis: ProfileSummaryAnalysis
4648
// CHECK-THIN-O0-NEXT: Running pass: CoroConditionalWrapper
4749
// CHECK-THIN-O0-NEXT: Running pass: CanonicalizeAliasesPass

clang/test/CodeGen/mcount-aix.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
1-
// RUN: %clang_cc1 -pg -triple powerpc-ibm-aix7.2.0.0 -emit-llvm %s -o - | FileCheck %s
2-
// RUN: %clang_cc1 -pg -triple powerpc64-ibm-aix7.2.0.0 -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK64
1+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple powerpc-ibm-aix7.2.0.0 -emit-llvm %s -o - | FileCheck %s
2+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple powerpc64-ibm-aix7.2.0.0 -emit-llvm %s -o - | FileCheck %s
33

44
void foo() {
5+
// CHECK: define void @foo() #0 {
56
}
67

78
void bar() {
9+
// CHECK: define void @bar() #0 {
810
foo();
911
}
10-
// CHECK: @[[GLOB0:[0-9]+]] = internal global i32 0
11-
// CHECK: @[[GLOB1:[0-9]+]] = internal global i32 0
12-
// CHECK64: @[[GLOB0:[0-9]+]] = internal global i64 0
13-
// CHECK64: @[[GLOB1:[0-9]+]] = internal global i64 0
14-
// CHECK-LABEL: @foo(
15-
// CHECK-NEXT: entry:
16-
// CHECK-NEXT: call void @__mcount(ptr @[[GLOB0]])
17-
// CHECK64-LABEL: @foo(
18-
// CHECK64-NEXT: entry:
19-
// CHECK64-NEXT: call void @__mcount(ptr @[[GLOB0]])
20-
// CHECK-LABEL: @bar(
21-
// CHECK-NEXT: entry:
22-
// CHECK-NEXT: call void @__mcount(ptr @[[GLOB1]])
23-
// CHECK64-LABEL: @bar(
24-
// CHECK64-NEXT: entry:
25-
// CHECK64-NEXT: call void @__mcount(ptr @[[GLOB1]])
12+
13+
// CHECK: attributes #0 = { {{.*}}"instrument-function-entry-inlined"="__mcount"

clang/test/CodeGen/mcount.c

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,58 @@
1-
// RUN: %clang_cc1 -pg -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2-
// RUN: %clang_cc1 -pg -triple i386-unknown-unknown -emit-llvm -O2 -o - %s | FileCheck %s
3-
// RUN: %clang_cc1 -pg -triple powerpc-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
4-
// RUN: %clang_cc1 -pg -triple powerpc64-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
5-
// RUN: %clang_cc1 -pg -triple powerpc64le-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
6-
// RUN: %clang_cc1 -pg -triple i386-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
7-
// RUN: %clang_cc1 -pg -triple x86_64-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
8-
// RUN: %clang_cc1 -pg -triple arm-netbsd-eabi -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
9-
// RUN: %clang_cc1 -pg -triple aarch64-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
10-
// RUN: %clang_cc1 -pg -triple loongarch32 -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
11-
// RUN: %clang_cc1 -pg -triple loongarch64 -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
12-
// RUN: %clang_cc1 -pg -triple mips-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
13-
// RUN: %clang_cc1 -pg -triple mips-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
14-
// RUN: %clang_cc1 -pg -triple mipsel-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
15-
// RUN: %clang_cc1 -pg -triple mips64-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
16-
// RUN: %clang_cc1 -pg -triple mips64el-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
17-
// RUN: %clang_cc1 -pg -triple riscv32-elf -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
18-
// RUN: %clang_cc1 -pg -triple riscv64-elf -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
19-
// RUN: %clang_cc1 -pg -triple riscv32-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
20-
// RUN: %clang_cc1 -pg -triple riscv64-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
21-
// RUN: %clang_cc1 -pg -triple riscv64-freebsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
22-
// RUN: %clang_cc1 -pg -triple riscv64-freebsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
23-
// RUN: %clang_cc1 -pg -triple riscv64-openbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
24-
// RUN: %clang_cc1 -pg -triple powerpc-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
25-
// RUN: %clang_cc1 -pg -triple powerpc64-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
26-
// RUN: %clang_cc1 -pg -triple powerpc64le-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
27-
// RUN: %clang_cc1 -pg -triple sparc-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
28-
// RUN: %clang_cc1 -pg -triple sparc64-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
29-
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -check-prefix=NO-MCOUNT
1+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple i386-unknown-unknown -emit-llvm -O2 -o - %s | FileCheck %s
3+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple powerpc-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
4+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple powerpc64-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
5+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple powerpc64le-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
6+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple i386-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
7+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple x86_64-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
8+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple arm-netbsd-eabi -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
9+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple aarch64-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
10+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple loongarch32 -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
11+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple loongarch64 -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
12+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple mips-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
13+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple mips-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
14+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple mipsel-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
15+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple mips64-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
16+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple mips64el-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
17+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple riscv32-elf -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
18+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple riscv64-elf -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
19+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple riscv32-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
20+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple riscv64-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
21+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple riscv64-freebsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
22+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple riscv64-freebsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
23+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple riscv64-openbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
24+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple powerpc-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
25+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple powerpc64-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
26+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple powerpc64le-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
27+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple sparc-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
28+
// RUN: %clang_cc1 -disable-llvm-passes -pg -triple sparc64-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
29+
// RUN: %clang_cc1 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s -check-prefix=NO-MCOUNT
3030

3131
int bar(void) {
32+
// CHECK: define dso_local i32 @bar() #0 {
3233
return 0;
3334
}
3435

3536
int foo(void) {
37+
// CHECK: define dso_local i32 @foo() #0 {
3638
return bar();
3739
}
3840

3941
int __attribute__((no_instrument_function)) no_instrument(void) {
42+
// CHECK: define dso_local i32 @no_instrument() #1 {
4043
return foo();
4144
}
4245

4346
int main(void) {
47+
// CHECK: define dso_local i32 @main() #0 {
4448
return no_instrument();
4549
}
4650

47-
// CHECK: call void @mcount
48-
// CHECK: call void @mcount
49-
// CHECK: call void @mcount
50-
// CHECK-NOT: call void @mcount
51-
// CHECK-PREFIXED: call void @_mcount
52-
// CHECK-PREFIXED: call void @_mcount
53-
// CHECK-PREFIXED: call void @_mcount
54-
// CHECK-PREFIXED-NOT: call void @_mcount
55-
// CHECK-DOUBLE-PREFIXED: call void @__mcount
56-
// CHECK-DOUBLE-PREFIXED: call void @__mcount
57-
// CHECK-DOUBLE-PREFIXED: call void @__mcount
58-
// CHECK-DOUBLE-PREFIXED-NOT: call void @__mcount
59-
// NO-MCOUNT-NOT: call void @{{.*}}mcount
60-
// NO-MCOUNT1-NOT: call void @{{.*}}mcount
51+
// CHECK: attributes #0 = { {{.*}} "instrument-function-entry-inlined"="mcount"
52+
// CHECK-NOT: attributes #1 = { {{.*}}"mcount"
53+
// CHECK-PREFIXED: attributes #0 = { {{.*}} "instrument-function-entry-inlined"="_mcount"
54+
// CHECK-PREFIXED-NOT: attributes #1 = { {{.*}}"_mcount"
55+
// CHECK-DOUBLE-PREFIXED: attributes #0 = { {{.*}} "instrument-function-entry-inlined"="__mcount"
56+
// CHECK-DOUBLE-PREFIXED-NOT: attributes #1 = { {{.*}}"__mcount"
57+
// NO-MCOUNT-NOT: attributes{{.*}}mcount
58+
// NO-MCOUNT1-NOT: attributes{{.*}}mcount

0 commit comments

Comments
 (0)