File: ms-secure-hotpatch-functions-file.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.4-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,236,516 kB
  • sloc: cpp: 7,619,569; ansic: 1,433,956; asm: 1,058,748; python: 252,181; f90: 94,671; objc: 70,753; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,585; awk: 3,523; javascript: 2,272; xml: 892; fortran: 770
file content (39 lines) | stat: -rw-r--r-- 1,327 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
; This tests annotating a function with marked_for_windows_hot_patching by using --ms-hotpatch-functions-file.
;
; RUN: echo this_gets_hotpatched > %t.patch-functions.txt
; RUN: llc -mtriple=x86_64-windows --ms-secure-hotpatch-functions-file=%t.patch-functions.txt < %s | FileCheck %s

source_filename = ".\\ms-secure-hotpatch-functions-file.ll"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc19.36.32537"

@some_global_var = external global i32

define noundef i32 @this_gets_hotpatched() #0 {
    %1 = load i32, ptr @some_global_var
    %2 = add i32 %1, 1
    ret i32 %2
}

attributes #0 = { mustprogress noinline nounwind optnone uwtable }

; CHECK: this_gets_hotpatched: # @this_gets_hotpatched
; CHECK-NEXT: bb.0:
; CHECK-NEXT: movq __ref_some_global_var(%rip), %rax
; CHECK-NEXT: movl (%rax), %eax
; CHECK-NEXT: addl $1, %eax
; CHECK-NEXT: retq

define noundef i32 @this_does_not_get_hotpatched() #1 {
    %1 = load i32, ptr @some_global_var
    %2 = add i32 %1, 1
    ret i32 %2
}

attributes #1 = { mustprogress noinline nounwind optnone uwtable }

; CHECK: this_does_not_get_hotpatched: # @this_does_not_get_hotpatched
; CHECK-NEXT: bb.0:
; CHECK-NEXT: movl some_global_var(%rip), %eax
; CHECK-NEXT: addl $1, %eax
; CHECK-NEXT: retq