xref: /llvm-project/llvm/test/CodeGen/WinCFGuard/cfguard-cast.ll (revision ff9af4c43ad71eeba2cabe99609cfaa0fd54c1d0)
1; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s
2; RUN: llc < %s -mtriple=x86_64-w64-windows-gnu | FileCheck %s
3
4; Check how constant function pointer casts are handled.
5
6declare void @unprototyped(...)
7
8define i32 @call_unprototyped() {
9  call void @unprototyped()
10  ret i32 0
11}
12
13; CHECK-LABEL: call_unprototyped:
14; CHECK: callq unprototyped
15; CHECK: xorl %eax, %eax
16; CHECK: retq
17
18declare void @escaped_cast()
19
20define i32 @escape_it_with_cast(ptr %p) {
21  store ptr @escaped_cast, ptr %p
22  ret i32 0
23}
24
25declare void @dead_constant()
26
27!llvm.module.flags = !{!0}
28!0 = !{i32 2, !"cfguard", i32 1}
29
30!dead_constant_root = !{!1}
31!1 = !DITemplateValueParameter(name: "dead_constant", value: ptr @dead_constant)
32
33; CHECK-LABEL: .section .gfids$y,"dr"
34; CHECK-NEXT:  .symidx escaped_cast
35; CHECK-NOT:   .symidx
36
37