1 ; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s --check-prefix=X64
2 ; RUN: llc -mtriple=i386-unknown-unknown < %s | FileCheck %s --check-prefix=X86
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7 ;; Checks ENDBR insertion after return twice functions.
8 ;; setjmp, sigsetjmp, savectx, vfork, getcontext
9 ;; setzx is not return twice function, should not followed by endbr.
10 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16 ; X64: callq sigsetjmp
22 ; X64: callq getcontext
29 ; X86: calll sigsetjmp
35 ; X86: calll getcontext
38 ; Function Attrs: noinline nounwind optnone uwtable
39 define dso_local void @foo() #0 {
41 %call = call i32 (i32, ...) @setjmp(i32 0) #1
42 %call1 = call i32 (i32, ...) @setzx(i32 0)
43 %call2 = call i32 (i32, ...) @sigsetjmp(i32 0) #1
44 %call3 = call i32 (i32, ...) @setzx(i32 0)
45 %call4 = call i32 (i32, ...) @savectx(i32 0) #1
46 %call5 = call i32 @vfork() #1
47 %call6 = call i32 (i32, ...) @setzx(i32 0)
48 %call7 = call i32 (i32, ...) @getcontext(i32 0) #1
52 ; Function Attrs: returns_twice
53 declare dso_local i32 @setjmp(...) #1
55 declare dso_local i32 @setzx(...)
57 ; Function Attrs: returns_twice
58 declare dso_local i32 @sigsetjmp(...) #1
60 ; Function Attrs: returns_twice
61 declare dso_local i32 @savectx(...) #1
63 ; Function Attrs: returns_twice
64 declare dso_local i32 @vfork() #1
66 ; Function Attrs: returns_twice
67 declare dso_local i32 @getcontext(...) #1
69 attributes #0 = { noinline nounwind optnone uwtable }
70 attributes #1 = { returns_twice }
72 !llvm.module.flags = !{!0, !1, !2}
74 !0 = !{i32 1, !"wchar_size", i32 4}
75 !1 = !{i32 8, !"cf-protection-return", i32 1}
76 !2 = !{i32 8, !"cf-protection-branch", i32 1}