[llvm] [X86][KCFI] Do not emit a type prefix for nocf_check functions (PR #158133)
Sami Tolvanen via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 12 15:47:34 PDT 2025
================
@@ -0,0 +1,39 @@
+; RUN: llc -mtriple=x86_64-unknown-unknown -x86-indirect-branch-tracking < %s | FileCheck %s
+
+; CHECK-LABEL: __cfi_cf_check_func:
+; CHECK: movl $12345678, %eax
+define void @cf_check_func() !kcfi_type !2 {
+; CHECK-LABEL: cf_check_func:
+; CHECK: endbr64
+; CHECK: retq
+entry:
+ ret void
+}
+
+; CHECK-NOT: __cfi_notype_cf_check_func:
----------------
samitolvanen wrote:
> We just need one `CHECK-NOT: __cfi_` and the next `; CHECK-NOT: __cfi_nocf_check_func:` can be removed.
Do you mean something like this?
```
; CHECK-NOT: __cfi_
define void @notype_cf_check_func() {
; CHECK-LABEL: notype_cf_check_func:
; CHECK: endbr64
; CHECK: retq
entry:
ret void
}
define void @nocf_check_func() #0 !kcfi_type !2 {
; CHECK-LABEL: nocf_check_func:
; CHECK-NOT: endbr64
; CHECK: retq
entry:
ret void
}
```
Perhaps I misunderstood your comment, because if we now end up emitting a `__cfi_` type prefix before `nocf_check_func`, FileCheck is not going to detect that. We're still going to need a second `CHECK-NOT: __cfi_` before `nocf_check_func` to catch this case.
Am I missing some clever FileCheck trick that would make this simpler?
https://github.com/llvm/llvm-project/pull/158133
More information about the llvm-commits
mailing list