1
2; RUN: llc < %s -mtriple=i686-pc-windows-msvc | FileCheck %s -check-prefix=X32
3; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s -check-prefix=X64
4; Control Flow Guard is currently only available on Windows
5
6; Test that Control Flow Guard checks are not added in modules with the
7; cfguard=1 flag (emit tables but no checks).
8
9
10declare void @target_func()
11
12define void @func_in_module_without_cfguard() #0 {
13entry:
14  %func_ptr = alloca void ()*, align 8
15  store void ()* @target_func, void ()** %func_ptr, align 8
16  %0 = load void ()*, void ()** %func_ptr, align 8
17
18  call void %0()
19  ret void
20
21  ; X32-NOT: __guard_check_icall_fptr
22  ; X64-NOT: __guard_dispatch_icall_fptr
23}
24
25!llvm.module.flags = !{!0}
26!0 = !{i32 2, !"cfguard", i32 1}
27