[llvm] 040c1b4 - Move EntryExitInstrumentation pass location
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 1 10:08:27 PST 2021
Author: Arthur Eubanks
Date: 2021-03-01T10:08:10-08:00
New Revision: 040c1b49d7a7eaa23d883ca363744944f5597d92
URL: https://github.com/llvm/llvm-project/commit/040c1b49d7a7eaa23d883ca363744944f5597d92
DIFF: https://github.com/llvm/llvm-project/commit/040c1b49d7a7eaa23d883ca363744944f5597d92.diff
LOG: Move EntryExitInstrumentation pass location
This seems to be more of a Clang thing rather than a generic LLVM thing,
so this moves it out of LLVM pipelines and as Clang extension hooks into
LLVM pipelines.
Move the post-inline EEInstrumentation out of the backend pipeline and
into a late pass, similar to other sanitizer passes. It doesn't fit
into the codegen pipeline.
Also fix up EntryExitInstrumentation not running at -O0 under the new
PM. PR49143
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D97608
Added:
Modified:
clang/lib/CodeGen/BackendUtil.cpp
clang/test/CodeGen/X86/x86_64-instrument-functions.c
clang/test/CodeGen/mcount.c
clang/test/Frontend/gnu-mcount.c
llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
llvm/lib/CodeGen/TargetPassConfig.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/test/CodeGen/AArch64/O0-pipeline.ll
llvm/test/CodeGen/AArch64/O3-pipeline.ll
llvm/test/CodeGen/AMDGPU/opt-pipeline.ll
llvm/test/CodeGen/ARM/O3-pipeline.ll
llvm/test/CodeGen/ARM/gnu_mcount_nc.ll
llvm/test/CodeGen/Mips/long-call-mcount.ll
llvm/test/CodeGen/Mips/mcount.ll
llvm/test/CodeGen/PowerPC/mcount-insertion.ll
llvm/test/CodeGen/X86/O0-pipeline.ll
llvm/test/CodeGen/X86/musttail-inalloca.ll
llvm/test/CodeGen/X86/opt-pipeline.ll
llvm/test/Other/opt-O0-pipeline-enable-matrix.ll
llvm/test/Other/opt-O0-pipeline.ll
llvm/test/Other/opt-O2-pipeline.ll
llvm/test/Other/opt-O3-pipeline-enable-matrix.ll
llvm/test/Other/opt-O3-pipeline.ll
llvm/test/Other/opt-Os-pipeline.ll
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index ba9a13ed1ddf..bfa47e5dc16c 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -367,6 +367,17 @@ static void addDataFlowSanitizerPass(const PassManagerBuilder &Builder,
PM.add(createDataFlowSanitizerLegacyPassPass(LangOpts.NoSanitizeFiles));
}
+static void addEntryExitInstrumentationPass(const PassManagerBuilder &Builder,
+ legacy::PassManagerBase &PM) {
+ PM.add(createEntryExitInstrumenterPass());
+}
+
+static void
+addPostInlineEntryExitInstrumentationPass(const PassManagerBuilder &Builder,
+ legacy::PassManagerBase &PM) {
+ PM.add(createPostInlineEntryExitInstrumenterPass());
+}
+
static TargetLibraryInfoImpl *createTLII(llvm::Triple &TargetTriple,
const CodeGenOptions &CodeGenOpts) {
TargetLibraryInfoImpl *TLII = new TargetLibraryInfoImpl(TargetTriple);
@@ -783,6 +794,20 @@ void EmitAssemblyHelper::CreatePasses(legacy::PassManager &MPM,
addDataFlowSanitizerPass);
}
+ if (CodeGenOpts.InstrumentFunctions ||
+ CodeGenOpts.InstrumentFunctionEntryBare ||
+ CodeGenOpts.InstrumentFunctionsAfterInlining ||
+ CodeGenOpts.InstrumentForProfiling) {
+ PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
+ addEntryExitInstrumentationPass);
+ PMBuilder.addExtension(PassManagerBuilder::EP_EnabledOnOptLevel0,
+ addEntryExitInstrumentationPass);
+ PMBuilder.addExtension(PassManagerBuilder::EP_OptimizerLast,
+ addPostInlineEntryExitInstrumentationPass);
+ PMBuilder.addExtension(PassManagerBuilder::EP_EnabledOnOptLevel0,
+ addPostInlineEntryExitInstrumentationPass);
+ }
+
// Set up the per-function pass manager.
FPM.add(new TargetLibraryInfoWrapperPass(*TLII));
if (CodeGenOpts.VerifyModule)
@@ -1317,12 +1342,20 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
/*DropTypeTests=*/true));
});
- if (Level != PassBuilder::OptimizationLevel::O0) {
+ if (CodeGenOpts.InstrumentFunctions ||
+ CodeGenOpts.InstrumentFunctionEntryBare ||
+ CodeGenOpts.InstrumentFunctionsAfterInlining ||
+ CodeGenOpts.InstrumentForProfiling) {
PB.registerPipelineStartEPCallback(
[](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
MPM.addPass(createModuleToFunctionPassAdaptor(
EntryExitInstrumenterPass(/*PostInlining=*/false)));
});
+ PB.registerOptimizerLastEPCallback(
+ [](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
+ MPM.addPass(createModuleToFunctionPassAdaptor(
+ EntryExitInstrumenterPass(/*PostInlining=*/true)));
+ });
}
// Register callbacks to schedule sanitizer passes at the appropriate part
diff --git a/clang/test/CodeGen/X86/x86_64-instrument-functions.c b/clang/test/CodeGen/X86/x86_64-instrument-functions.c
index ab87fe375ff3..14e2199b0aed 100644
--- a/clang/test/CodeGen/X86/x86_64-instrument-functions.c
+++ b/clang/test/CodeGen/X86/x86_64-instrument-functions.c
@@ -1,41 +1,41 @@
// REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions -O2 -o - %s | FileCheck %s
-// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions-after-inlining -O2 -o - %s | FileCheck -check-prefix=NOINLINE %s
+// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions -O0 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions -O2 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions-after-inlining -O2 -o - -emit-llvm %s | FileCheck -check-prefix=NOINLINE %s
-// RUN: %clang_cc1 -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions -O2 -o - %s | FileCheck %s
-// RUN: %clang_cc1 -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions-after-inlining -O2 -o - %s | FileCheck -check-prefix=NOINLINE %s
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions -O0 -o - -emit-llvm %s | FileCheck %s
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions -O2 -o - -emit-llvm %s | FileCheck %s
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions-after-inlining -O2 -o - -emit-llvm %s | FileCheck -check-prefix=NOINLINE %s
-// It's not so nice having asm tests in Clang, but we need to check that we set
-// up the pipeline correctly in order to have the instrumentation inserted.
-
-int leaf(int x) {
+__attribute__((always_inline)) int leaf(int x) {
return x;
-// CHECK-LABEL: leaf:
-// CHECK: callq __cyg_profile_func_enter
+// CHECK-LABEL: define {{.*}} @leaf
+// CHECK: call void @__cyg_profile_func_enter
// CHECK-NOT: cyg_profile
-// CHECK: callq __cyg_profile_func_exit
+// CHECK: call void @__cyg_profile_func_exit
// CHECK-NOT: cyg_profile
// CHECK: ret
}
int root(int x) {
return leaf(x);
-// CHECK-LABEL: root:
-// CHECK: callq __cyg_profile_func_enter
+// CHECK-LABEL: define {{.*}} @root
+// CHECK: call void @__cyg_profile_func_enter
// CHECK-NOT: cyg_profile
// Inlined from leaf():
-// CHECK: callq __cyg_profile_func_enter
+// CHECK: call void @__cyg_profile_func_enter
// CHECK-NOT: cyg_profile
-// CHECK: callq __cyg_profile_func_exit
-
+// CHECK: call void @__cyg_profile_func_exit
// CHECK-NOT: cyg_profile
-// CHECK: callq __cyg_profile_func_exit
+
+// CHECK: call void @__cyg_profile_func_exit
// CHECK: ret
-// NOINLINE-LABEL: root:
-// NOINLINE: callq __cyg_profile_func_enter
+// NOINLINE-LABEL: define {{.*}} @root
+// NOINLINE: call void @__cyg_profile_func_enter
+// NOINLINE-NOT: cyg_profile
+// NOINLINE: call void @__cyg_profile_func_exit
// NOINLINE-NOT: cyg_profile
-// NOINLINE: callq __cyg_profile_func_exit
// NOINLINE: ret
}
diff --git a/clang/test/CodeGen/mcount.c b/clang/test/CodeGen/mcount.c
index c67cf03c0016..649f0b56949d 100644
--- a/clang/test/CodeGen/mcount.c
+++ b/clang/test/CodeGen/mcount.c
@@ -35,11 +35,17 @@ int main(void) {
return no_instrument();
}
-// CHECK: attributes #0 = { {{.*}}"instrument-function-entry-inlined"="mcount"{{.*}} }
-// CHECK: attributes #1 = { {{.*}} }
-// CHECK-PREFIXED: attributes #0 = { {{.*}}"instrument-function-entry-inlined"="_mcount"{{.*}} }
-// CHECK-PREFIXED: attributes #1 = { {{.*}} }
-// CHECK-DOUBLE-PREFIXED: attributes #0 = { {{.*}}"instrument-function-entry-inlined"="__mcount"{{.*}} }
-// CHECK-DOUBLE-PREFIXED: attributes #1 = { {{.*}} }
-// NO-MCOUNT-NOT: attributes #{{[0-9]}} = { {{.*}}"instrument-function-entry-inlined"={{.*}} }
-// NO-MCOUNT1-NOT: attributes #1 = { {{.*}}"instrument-function-entry-inlined"={{.*}} }
+// CHECK: call void @mcount
+// CHECK: call void @mcount
+// CHECK: call void @mcount
+// CHECK-NOT: call void @mcount
+// CHECK-PREFIXED: call void @_mcount
+// CHECK-PREFIXED: call void @_mcount
+// CHECK-PREFIXED: call void @_mcount
+// CHECK-PREFIXED-NOT: call void @_mcount
+// CHECK-DOUBLE-PREFIXED: call void @__mcount
+// CHECK-DOUBLE-PREFIXED: call void @__mcount
+// CHECK-DOUBLE-PREFIXED: call void @__mcount
+// CHECK-DOUBLE-PREFIXED-NOT: call void @__mcount
+// NO-MCOUNT-NOT: call void @{{.*}}mcount
+// NO-MCOUNT1-NOT: call void @{{.*}}mcount
diff --git a/clang/test/Frontend/gnu-mcount.c b/clang/test/Frontend/gnu-mcount.c
index 85e56f84506a..e5ed55c34ef8 100644
--- a/clang/test/Frontend/gnu-mcount.c
+++ b/clang/test/Frontend/gnu-mcount.c
@@ -43,10 +43,10 @@ int f() {
// CHECK-LABEL: f
// TODO: add profiling support for arm-baremetal
-// UNSUPPORTED-NOT: "instrument-function-entry-inlined"=
-// CHECK-ARM-EABI: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01mcount"{{.*}} }
-// MCOUNT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="mcount"
-// UNDER: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01_mcount"
-// UNDER_UNDER: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="__mcount"
-// CHECK-ARM64-EABI-FREEBSD: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"=".mcount"{{.*}} }
-// CHECK-ARM-EABI-MEABI-GNU: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="llvm.arm.gnu.eabi.mcount"{{.*}} }
+// UNSUPPORTED-NOT: call void
+// CHECK-ARM-EABI: call void @"\01mcount"()
+// MCOUNT: call void @mcount()
+// UNDER: call void @"\01_mcount"()
+// UNDER_UNDER: call void @__mcount()
+// CHECK-ARM64-EABI-FREEBSD: call void @.mcount()
+// CHECK-ARM-EABI-MEABI-GNU: call void @llvm.arm.gnu.eabi.mcount()
diff --git a/llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h b/llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
index 3913693af359..31c023019272 100644
--- a/llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
+++ b/llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
@@ -28,6 +28,8 @@ struct EntryExitInstrumenterPass
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
bool PostInlining;
+
+ static bool isRequired() { return true; }
};
} // namespace llvm
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index 7b528a80b789..6e8023542367 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -864,9 +864,6 @@ void TargetPassConfig::addIRPasses() {
if (getOptLevel() != CodeGenOpt::None && !DisablePartialLibcallInlining)
addPass(createPartiallyInlineLibCallsPass());
- // Instrument function entry and exit, e.g. with calls to mcount().
- addPass(createPostInlineEntryExitInstrumenterPass());
-
// Add scalarization of target's unsupported masked memory intrinsics pass.
// the unsupported intrinsic will be replaced with a chain of basic blocks,
// that stores/loads element one-by-one if the appropriate mask bit is set.
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index 269b82eba7ad..3b495dd71c2c 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -300,7 +300,6 @@ void PassManagerBuilder::addInitialAliasAnalysisPasses(
void PassManagerBuilder::populateFunctionPassManager(
legacy::FunctionPassManager &FPM) {
addExtensionsToPM(EP_EarlyAsPossible, FPM);
- FPM.add(createEntryExitInstrumenterPass());
// Add LibraryInfo if we have some.
if (LibraryInfo)
diff --git a/llvm/test/CodeGen/AArch64/O0-pipeline.ll b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
index 4f7a3cf43f32..aad8e9a278bd 100644
--- a/llvm/test/CodeGen/AArch64/O0-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
@@ -21,7 +21,6 @@
; CHECK-NEXT: Shadow Stack GC Lowering
; CHECK-NEXT: Lower constant intrinsics
; CHECK-NEXT: Remove unreachable blocks from the CFG
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (post inlining)
; CHECK-NEXT: Scalarize Masked Memory Intrinsics
; CHECK-NEXT: Expand reduction intrinsics
; CHECK-NEXT: AArch64 Stack Tagging
diff --git a/llvm/test/CodeGen/AArch64/O3-pipeline.ll b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
index 2e42959987b6..0437adc8b9b9 100644
--- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
@@ -56,7 +56,6 @@
; CHECK-NEXT: Constant Hoisting
; CHECK-NEXT: Replace intrinsics with calls to vector library
; CHECK-NEXT: Partially inline calls to library functions
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (post inlining)
; CHECK-NEXT: Scalarize Masked Memory Intrinsics
; CHECK-NEXT: Expand reduction intrinsics
; CHECK-NEXT: Stack Safety Analysis
diff --git a/llvm/test/CodeGen/AMDGPU/opt-pipeline.ll b/llvm/test/CodeGen/AMDGPU/opt-pipeline.ll
index 865f6c0825dc..34e5e6c647da 100644
--- a/llvm/test/CodeGen/AMDGPU/opt-pipeline.ll
+++ b/llvm/test/CodeGen/AMDGPU/opt-pipeline.ll
@@ -10,7 +10,6 @@
; GCN-O0-NEXT: FunctionPass Manager
; GCN-O0-NEXT: Early propagate attributes from kernels to functions
; GCN-O0-NEXT: Replace builtin math calls with that native versions.
-; GCN-O0-NEXT: Instrument function entry/exit with calls to e.g. mcount() (pre inlining)
; GCN-O0-NEXT: Pass Arguments:
; GCN-O0-NEXT: Target Library Information
@@ -42,7 +41,6 @@
; GCN-O1-NEXT: Basic Alias Analysis (stateless AA impl)
; GCN-O1-NEXT: Function Alias Analysis Results
; GCN-O1-NEXT: Simplify well-known AMD library calls
-; GCN-O1-NEXT: Instrument function entry/exit with calls to e.g. mcount() (pre inlining)
; GCN-O1-NEXT: Simplify the CFG
; GCN-O1-NEXT: Dominator Tree Construction
; GCN-O1-NEXT: SROA
@@ -352,7 +350,6 @@
; GCN-O2-NEXT: Basic Alias Analysis (stateless AA impl)
; GCN-O2-NEXT: Function Alias Analysis Results
; GCN-O2-NEXT: Simplify well-known AMD library calls
-; GCN-O2-NEXT: Instrument function entry/exit with calls to e.g. mcount() (pre inlining)
; GCN-O2-NEXT: Simplify the CFG
; GCN-O2-NEXT: Dominator Tree Construction
; GCN-O2-NEXT: SROA
@@ -707,7 +704,6 @@
; GCN-O3-NEXT: Basic Alias Analysis (stateless AA impl)
; GCN-O3-NEXT: Function Alias Analysis Results
; GCN-O3-NEXT: Simplify well-known AMD library calls
-; GCN-O3-NEXT: Instrument function entry/exit with calls to e.g. mcount() (pre inlining)
; GCN-O3-NEXT: Simplify the CFG
; GCN-O3-NEXT: Dominator Tree Construction
; GCN-O3-NEXT: SROA
diff --git a/llvm/test/CodeGen/ARM/O3-pipeline.ll b/llvm/test/CodeGen/ARM/O3-pipeline.ll
index 21f09fd097e4..384d86dbc828 100644
--- a/llvm/test/CodeGen/ARM/O3-pipeline.ll
+++ b/llvm/test/CodeGen/ARM/O3-pipeline.ll
@@ -36,7 +36,6 @@
; CHECK-NEXT: Constant Hoisting
; CHECK-NEXT: Replace intrinsics with calls to vector library
; CHECK-NEXT: Partially inline calls to library functions
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (post inlining)
; CHECK-NEXT: Scalarize Masked Memory Intrinsics
; CHECK-NEXT: Expand reduction intrinsics
; CHECK-NEXT: Natural Loop Information
diff --git a/llvm/test/CodeGen/ARM/gnu_mcount_nc.ll b/llvm/test/CodeGen/ARM/gnu_mcount_nc.ll
index c36991f879a5..510f91538325 100644
--- a/llvm/test/CodeGen/ARM/gnu_mcount_nc.ll
+++ b/llvm/test/CodeGen/ARM/gnu_mcount_nc.ll
@@ -18,6 +18,7 @@ define dso_local void @callee() #0 {
; CHECK-THUMB-FAST-ISEL-NEXT: bl __gnu_mcount_nc
; CHECK-THUMB-GLOBAL-ISEL: push {lr}
; CHECK-THUMB-GLOBAL-ISEL-NEXT: bl __gnu_mcount_nc
+ call void @llvm.arm.gnu.eabi.mcount()
ret void
}
@@ -34,8 +35,12 @@ define dso_local void @caller() #0 {
; CHECK-THUMB-FAST-ISEL-NEXT: bl __gnu_mcount_nc
; CHECK-THUMB-GLOBAL-ISEL: push {lr}
; CHECK-THUMB-GLOBAL-ISEL-NEXT: bl __gnu_mcount_nc
+ call void @llvm.arm.gnu.eabi.mcount()
call void @callee()
ret void
}
-attributes #0 = { nofree nounwind "instrument-function-entry-inlined"="llvm.arm.gnu.eabi.mcount" }
+declare void @llvm.arm.gnu.eabi.mcount() #1
+
+attributes #0 = { nofree nounwind }
+attributes #1 = { nounwind }
diff --git a/llvm/test/CodeGen/Mips/long-call-mcount.ll b/llvm/test/CodeGen/Mips/long-call-mcount.ll
index 580f452526f7..40d3b74ee579 100644
--- a/llvm/test/CodeGen/Mips/long-call-mcount.ll
+++ b/llvm/test/CodeGen/Mips/long-call-mcount.ll
@@ -4,9 +4,9 @@
; RUN: llc -march=mips -target-abi o32 --mattr=-long-calls,+noabicalls < %s \
; RUN: -mips-jalr-reloc=false | FileCheck -check-prefixes=CHECK,SHORT %s
-; Function Attrs: noinline nounwind optnone
-define void @foo() #0 {
+define void @foo() {
entry:
+ call void @_mcount()
ret void
; CHECK-LABEL: foo
@@ -16,4 +16,4 @@ entry:
; SHORT: jal _mcount
}
-attributes #0 = { "instrument-function-entry-inlined"="_mcount" }
+declare void @_mcount()
diff --git a/llvm/test/CodeGen/Mips/mcount.ll b/llvm/test/CodeGen/Mips/mcount.ll
index fe8cee9d78d8..ee0409a021c8 100644
--- a/llvm/test/CodeGen/Mips/mcount.ll
+++ b/llvm/test/CodeGen/Mips/mcount.ll
@@ -15,8 +15,7 @@
; Test that checks ABI for _mcount calls.
-; Function Attrs: noinline nounwind optnone
-define void @foo() #0 {
+define void @foo() {
; MIPS32-LABEL: foo:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: addiu $sp, $sp, -24
@@ -117,7 +116,8 @@ define void @foo() #0 {
; MIPS32-MM-PIC-NEXT: jr $ra
; MIPS32-MM-PIC-NEXT: addiu $sp, $sp, 24
entry:
+ call void @_mcount()
ret void
}
-attributes #0 = { "instrument-function-entry-inlined"="_mcount" }
+declare void @_mcount()
diff --git a/llvm/test/CodeGen/PowerPC/mcount-insertion.ll b/llvm/test/CodeGen/PowerPC/mcount-insertion.ll
index 502347a3af19..a5cc68a72dc9 100644
--- a/llvm/test/CodeGen/PowerPC/mcount-insertion.ll
+++ b/llvm/test/CodeGen/PowerPC/mcount-insertion.ll
@@ -1,4 +1,4 @@
-; RUN: opt -ee-instrument < %s | opt -inline | llc -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s
+; RUN: opt -ee-instrument < %s | opt -inline | opt -post-inline-ee-instrument | llc -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s
; The run-line mimics how Clang might run the instrumentation passes.
diff --git a/llvm/test/CodeGen/X86/O0-pipeline.ll b/llvm/test/CodeGen/X86/O0-pipeline.ll
index 7d2ee5f27142..8b0c604233ae 100644
--- a/llvm/test/CodeGen/X86/O0-pipeline.ll
+++ b/llvm/test/CodeGen/X86/O0-pipeline.ll
@@ -24,7 +24,6 @@
; CHECK-NEXT: Shadow Stack GC Lowering
; CHECK-NEXT: Lower constant intrinsics
; CHECK-NEXT: Remove unreachable blocks from the CFG
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (post inlining)
; CHECK-NEXT: Scalarize Masked Memory Intrinsics
; CHECK-NEXT: Expand reduction intrinsics
; CHECK-NEXT: Expand indirectbr instructions
diff --git a/llvm/test/CodeGen/X86/musttail-inalloca.ll b/llvm/test/CodeGen/X86/musttail-inalloca.ll
index c17d29c4c71d..c0e571a7213b 100644
--- a/llvm/test/CodeGen/X86/musttail-inalloca.ll
+++ b/llvm/test/CodeGen/X86/musttail-inalloca.ll
@@ -13,6 +13,7 @@ target triple = "i386-pc-windows-msvc19.16.0"
declare dso_local x86_thiscallcc void @methodWithVtorDisp(i8* nocapture readonly, <{ %struct.Args }>* inalloca)
+; Function Attrs: nounwind optsize
define dso_local x86_thiscallcc void @methodWithVtorDisp_thunk(i8* %0, <{ %struct.Args }>* inalloca %1) #0 {
; CHECK-LABEL: methodWithVtorDisp_thunk:
; CHECK: # %bb.0:
@@ -31,8 +32,16 @@ define dso_local x86_thiscallcc void @methodWithVtorDisp_thunk(i8* %0, <{ %struc
%5 = load i32, i32* %4, align 4
%6 = sub i32 0, %5
%7 = getelementptr i8, i8* %0, i32 %6
+ %8 = call i8* @llvm.returnaddress(i32 0)
+ call void @__cyg_profile_func_exit(i8* bitcast (void (i8*, <{ %struct.Args }>*)* @methodWithVtorDisp_thunk to i8*), i8* %8)
musttail call x86_thiscallcc void @methodWithVtorDisp(i8* %7, <{ %struct.Args }>* inalloca nonnull %1)
ret void
}
-attributes #0 = { nounwind optsize "instrument-function-exit-inlined"="__cyg_profile_func_exit" }
+declare void @__cyg_profile_func_exit(i8*, i8*)
+
+; Function Attrs: nofree nosync nounwind readnone willreturn
+declare i8* @llvm.returnaddress(i32 immarg) #1
+
+attributes #0 = { nounwind optsize }
+attributes #1 = { nofree nosync nounwind readnone willreturn }
diff --git a/llvm/test/CodeGen/X86/opt-pipeline.ll b/llvm/test/CodeGen/X86/opt-pipeline.ll
index 8ca32ff306ee..a99e2033aea3 100644
--- a/llvm/test/CodeGen/X86/opt-pipeline.ll
+++ b/llvm/test/CodeGen/X86/opt-pipeline.ll
@@ -53,7 +53,6 @@
; CHECK-NEXT: Constant Hoisting
; CHECK-NEXT: Replace intrinsics with calls to vector library
; CHECK-NEXT: Partially inline calls to library functions
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (post inlining)
; CHECK-NEXT: Scalarize Masked Memory Intrinsics
; CHECK-NEXT: Expand reduction intrinsics
; CHECK-NEXT: Interleaved Access Pass
diff --git a/llvm/test/Other/opt-O0-pipeline-enable-matrix.ll b/llvm/test/Other/opt-O0-pipeline-enable-matrix.ll
index f754f6d1a513..15784f23740e 100644
--- a/llvm/test/Other/opt-O0-pipeline-enable-matrix.ll
+++ b/llvm/test/Other/opt-O0-pipeline-enable-matrix.ll
@@ -6,7 +6,6 @@
; CHECK-NEXT: Target Transform Information
; CHECK-NEXT: FunctionPass Manager
; CHECK-NEXT: Module Verifier
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (pre inlining)
; CHECK-NEXT: Lower the matrix intrinsics (minimal)
diff --git a/llvm/test/Other/opt-O0-pipeline.ll b/llvm/test/Other/opt-O0-pipeline.ll
index 80ab608b05ce..c47642e1f0d4 100644
--- a/llvm/test/Other/opt-O0-pipeline.ll
+++ b/llvm/test/Other/opt-O0-pipeline.ll
@@ -10,7 +10,6 @@
; CHECK-NEXT: FunctionPass Manager
; CHECK-NEXT: Module Verifier
; CHECK-EXT: Good Bye World Pass
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (pre inlining)
; CHECK-NEXT: Pass Arguments:
; CHECK-NEXT: Target Library Information
; CHECK-NEXT: Target Transform Information
diff --git a/llvm/test/Other/opt-O2-pipeline.ll b/llvm/test/Other/opt-O2-pipeline.ll
index d46a5a1da6a4..f7217c122fdb 100644
--- a/llvm/test/Other/opt-O2-pipeline.ll
+++ b/llvm/test/Other/opt-O2-pipeline.ll
@@ -12,7 +12,6 @@
; CHECK-NEXT: Module Verifier
; CHECK-EXT: Good Bye World Pass
; CHECK-NOEXT-NOT: Good Bye World Pass
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (pre inlining)
; CHECK-NEXT: Simplify the CFG
; CHECK-NEXT: Dominator Tree Construction
; CHECK-NEXT: SROA
diff --git a/llvm/test/Other/opt-O3-pipeline-enable-matrix.ll b/llvm/test/Other/opt-O3-pipeline-enable-matrix.ll
index 9b7f3c2e2a9a..6b98c1f80d9e 100644
--- a/llvm/test/Other/opt-O3-pipeline-enable-matrix.ll
+++ b/llvm/test/Other/opt-O3-pipeline-enable-matrix.ll
@@ -12,7 +12,6 @@
; CHECK-NEXT: Module Verifier
; CHECK-EXT: Good Bye World Pass
; CHECK-NOEXT-NOT: Good Bye World Pass
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (pre inlining)
; CHECK-NEXT: Simplify the CFG
; CHECK-NEXT: Dominator Tree Construction
; CHECK-NEXT: SROA
diff --git a/llvm/test/Other/opt-O3-pipeline.ll b/llvm/test/Other/opt-O3-pipeline.ll
index 78a96e8d2944..00a1d61ac058 100644
--- a/llvm/test/Other/opt-O3-pipeline.ll
+++ b/llvm/test/Other/opt-O3-pipeline.ll
@@ -12,7 +12,6 @@
; CHECK-NEXT: Module Verifier
; CHECK-EXT: Good Bye World Pass
; CHECK-NOEXT-NOT: Good Bye World Pass
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (pre inlining)
; CHECK-NEXT: Simplify the CFG
; CHECK-NEXT: Dominator Tree Construction
; CHECK-NEXT: SROA
diff --git a/llvm/test/Other/opt-Os-pipeline.ll b/llvm/test/Other/opt-Os-pipeline.ll
index fdbaeb04af6d..21f9b8c6009e 100644
--- a/llvm/test/Other/opt-Os-pipeline.ll
+++ b/llvm/test/Other/opt-Os-pipeline.ll
@@ -12,7 +12,6 @@
; CHECK-NEXT: Module Verifier
; CHECK-EXT: Good Bye World Pass
; CHECK-NOEXT-NOT: Good Bye World Pass
-; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (pre inlining)
; CHECK-NEXT: Simplify the CFG
; CHECK-NEXT: Dominator Tree Construction
; CHECK-NEXT: SROA
More information about the llvm-commits
mailing list