[clang] [llvm] wip: Move instrumentation passes (PR #92171)

Egor Pasko via cfe-commits cfe-commits at lists.llvm.org
Wed May 22 03:24:27 PDT 2024


================
@@ -0,0 +1,29 @@
+; RUN: llc -mtriple=x86_64-- -O0 < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-- -O1 < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-- -O2 < %s | FileCheck %s
+
+; The codegen should insert post-inlining instrumentation calls and should not
+; insert pre-inlining instrumentation.
+
+; CHECK-NOT:       callq __cyg_profile_func_enter
+
+define void @leaf_function() #0 {
+; CHECK-LABEL: leaf_function:
+; CHECK:       callq __cyg_profile_func_enter_bare
+; CHECK:       movq	leaf_function at GOTPCREL(%rip), %rdi
----------------
pasko wrote:

Yeah, I was also thinking that the use of a particular relocation makes it more brittle. I think it is nice to check that func_exit is used without an argument (unlike `__cyg_profile_func_enter_bare`). This can be done with the `CHECK-NEXT` on the line that follows. Though I did not notice this kind of parameter passing is already checked in `llvm/test/Transforms/EntryExitInstrumenter/mcount.ll`, hence now I am not sure how much value there is in this check.

I would not probably regret removing the line, but I'd like to try one more thing:
```
; CHECK:       {{.*}} %rdi
; CHECK-NEXT:  callq  __cyg_profile_func_exit
```

Will it blend?

https://github.com/llvm/llvm-project/pull/92171


More information about the cfe-commits mailing list