40 lines · plain
1; This tests hotpatching functions that bypass double-indirection for global variables.2;3; RUN: llc -mtriple=x86_64-windows < %s | FileCheck %s4 5source_filename = ".\\ms-secure-hotpatch-direct-global-access.ll"6target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"7target triple = "x86_64-pc-windows-msvc19.36.32537"8 9@some_global_var = external global i32 #210 11define noundef i32 @this_gets_hotpatched() #0 {12 %1 = load i32, ptr @some_global_var13 %2 = add i32 %1, 114 ret i32 %215}16 17attributes #0 = { "marked_for_windows_hot_patching" mustprogress noinline nounwind optnone uwtable }18 19; CHECK: this_gets_hotpatched: # @this_gets_hotpatched20; CHECK-NEXT: bb.0:21; CHECK-NEXT: movl some_global_var(%rip), %eax22; CHECK-NEXT: addl $1, %eax23; CHECK-NEXT: retq24 25define noundef i32 @this_does_not_get_hotpatched() #1 {26 %1 = load i32, ptr @some_global_var27 %2 = add i32 %1, 128 ret i32 %229}30 31attributes #1 = { mustprogress noinline nounwind optnone uwtable }32 33attributes #2 = { "allow_direct_access_in_hot_patch_function" }34 35; CHECK: this_does_not_get_hotpatched: # @this_does_not_get_hotpatched36; CHECK-NEXT: bb.0:37; CHECK-NEXT: movl some_global_var(%rip), %eax38; CHECK-NEXT: addl $1, %eax39; CHECK-NEXT: retq40