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