1 ; RUN: llc -mtriple=x86_64-unknown-unknown -x86-indirect-branch-tracking < %s | FileCheck %s
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4 ;; This test verify the handling of ''nocf_check'' attribute by the backend. ;;
5 ;; The file was generated using the following C code: ;;
7 ;; void __attribute__((nocf_check)) NoCfCheckFunc(void) {} ;;
9 ;; typedef void(*FuncPointer)(void); ;;
10 ;; void NoCfCheckCall(FuncPointer f) { ;;
11 ;; __attribute__((nocf_check)) FuncPointer p = f; ;;
14 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16 ; Make sure that a function with ''nocf_check'' attribute is not instrumented
17 ; with endbr instruction at the beginning.
18 define void @NoCfCheckFunc() #0 {
19 ; CHECK-LABEL: NoCfCheckFunc
26 ; Make sure that notrack prefix is added before a call with ''nocf_check'' attribute.
27 define void @NoCfCheckCall(void ()* %f) {
28 ; CHECK-LABEL: NoCfCheckCall
31 %f.addr = alloca void ()*, align 4
32 %p = alloca void ()*, align 4
33 store void ()* %f, void ()** %f.addr, align 4
34 %0 = load void ()*, void ()** %f.addr, align 4
35 store void ()* %0, void ()** %p, align 4
36 %1 = load void ()*, void ()** %p, align 4
41 attributes #0 = { noinline nocf_check nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
42 attributes #1 = { nocf_check }
44 !llvm.module.flags = !{!0}
46 !0 = !{i32 4, !"cf-protection-branch", i32 1}