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