• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5;; foo
6;; -----
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11
12; X64:           callq   setjmp
13; X64-NEXT:      endbr64
14; X64:           callq   setzx
15; X64-NEXT:      xorl
16; X64:           callq   sigsetjmp
17; X64-NEXT:      endbr64
18; X64:           callq   savectx
19; X64-NEXT:      endbr64
20; X64:           callq   vfork
21; X64-NEXT:      endbr64
22; X64:           callq   getcontext
23; X64-NEXT:      endbr64
24
25; X86:           calll   setjmp
26; X86-NEXT:      endbr32
27; X86:           calll   setzx
28; X86-NEXT:      xorl
29; X86:           calll   sigsetjmp
30; X86-NEXT:      endbr32
31; X86:           calll   savectx
32; X86-NEXT:      endbr32
33; X86:           calll   vfork
34; X86-NEXT:      endbr32
35; X86:           calll   getcontext
36; X86-NEXT:      endbr32
37
38; Function Attrs: noinline nounwind optnone uwtable
39define dso_local void @foo() #0 {
40entry:
41  %call = call i32 (i32, ...) bitcast (i32 (...)* @setjmp to i32 (i32, ...)*)(i32 0) #1
42  %call1 = call i32 (i32, ...) bitcast (i32 (...)* @setzx to i32 (i32, ...)*)(i32 0)
43  %call2 = call i32 (i32, ...) bitcast (i32 (...)* @sigsetjmp to i32 (i32, ...)*)(i32 0) #1
44  %call3 = call i32 (i32, ...) bitcast (i32 (...)* @setzx to i32 (i32, ...)*)(i32 0)
45  %call4 = call i32 (i32, ...) bitcast (i32 (...)* @savectx to i32 (i32, ...)*)(i32 0) #1
46  %call5 = call i32 @vfork() #1
47  %call6 = call i32 (i32, ...) bitcast (i32 (...)* @setzx to i32 (i32, ...)*)(i32 0)
48  %call7 = call i32 (i32, ...) bitcast (i32 (...)* @getcontext to i32 (i32, ...)*)(i32 0) #1
49  ret void
50}
51
52; Function Attrs: returns_twice
53declare dso_local i32 @setjmp(...) #1
54
55declare dso_local i32 @setzx(...)
56
57; Function Attrs: returns_twice
58declare dso_local i32 @sigsetjmp(...) #1
59
60; Function Attrs: returns_twice
61declare dso_local i32 @savectx(...) #1
62
63; Function Attrs: returns_twice
64declare dso_local i32 @vfork() #1
65
66; Function Attrs: returns_twice
67declare dso_local i32 @getcontext(...) #1
68
69attributes #0 = { noinline nounwind optnone uwtable }
70attributes #1 = { returns_twice }
71
72!llvm.module.flags = !{!0, !1, !2}
73
74!0 = !{i32 1, !"wchar_size", i32 4}
75!1 = !{i32 4, !"cf-protection-return", i32 1}
76!2 = !{i32 4, !"cf-protection-branch", i32 1}
77