Debian Codegraph @

clang/test/CodeGen/X86/ms-secure-hotpatch-lto.c

raw
1 // REQUIRES: x86-registered-target
2
3 // This verifies that hotpatch function attributes are correctly propagated through LLVM IR when compiling with LTO.
4 //
5 // RUN: %clang_cl -c --target=x86_64-windows-msvc -O2 /Z7 -fms-secure-hotpatch-functions-list=this_gets_hotpatched -flto /Fo%t.bc -- %s
6 // RUN: llvm-dis %t.bc -o - | FileCheck %s
7 //
8 // CHECK-LABEL: define dso_local noundef i32 @this_gets_hotpatched()
9 // CHECK-SAME: #0
10 //
11 // CHECK-LABEL: define dso_local noundef i32 @this_does_not_get_hotpatched()
12 // CHECK-SAME: #1
13
14 // CHECK: attributes #0
15 // CHECK-SAME: "marked_for_windows_hot_patching"
16
17 // CHECK: attributes #1
18 // CHECK-NOT: "marked_for_windows_hot_patching"
19
20 int __declspec(noinline) this_gets_hotpatched() {
21 return 42;
22 }
23
24 int __declspec(noinline) this_does_not_get_hotpatched() {
25 return this_gets_hotpatched() + 100;
26 }