Skip to content

Commit f3a66ec

Browse files
committed
[asan][test] Re-generate asan-check-memaccess-add.ll with update_llc_test_checks.py
* LABEL is important to give a better diagnostic in case a check pattern fails * Some NOT negative patterns are not effective. NEXT is useful to ensure a code sequence has the desired instructions and report a better diagnostic if something goes off. * Since the ABI says the first parameter is in RDI. Replacing the pattern `[[REG16:.*]]` with `RDI` should not cause maintenance burden. Since the test is pretty mechanical, just use update_llc_test_checks.py to re-generate it. Most functions can use `nounwind` to avoid CFI directives. Reviewed By: kstoimenov, vitalybuka Differential Revision: https://reviews.llvm.org/D118864
1 parent 9596784 commit f3a66ec

File tree

1 file changed

+43
-34
lines changed

1 file changed

+43
-34
lines changed

llvm/test/CodeGen/X86/asan-check-memaccess-add.ll

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,76 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
12
; RUN: llc < %s | FileCheck %s
23

34
target triple = "x86_64-unknown-linux-gnu"
45

56
define void @load1(i8* nocapture readonly %x) {
6-
; CHECK: pushq %rax
7-
; CHECK-NOT: push %rbp
8-
; CHECK: callq __asan_check_load_add_1_[[REG1:.*]]
9-
; CHECK: callq __asan_check_store_add_1_[[REG1]]
10-
; CHECK-NOT: pop %rbp
11-
; CHECK: popq %rax
7+
; CHECK-LABEL: load1:
8+
; CHECK: # %bb.0:
9+
; CHECK-NEXT: pushq %rax
10+
; CHECK-NEXT: .cfi_def_cfa_offset 16
11+
; CHECK-NEXT: callq __asan_check_load_add_1_RDI
12+
; CHECK-NEXT: callq __asan_check_store_add_1_RDI
13+
; CHECK-NEXT: popq %rax
14+
; CHECK-NEXT: .cfi_def_cfa_offset 8
15+
; CHECK-NEXT: retq
1216
call void @llvm.asan.check.memaccess(i8* %x, i32 0)
1317
call void @llvm.asan.check.memaccess(i8* %x, i32 32)
1418
ret void
1519
}
1620

17-
define void @load2(i16* nocapture readonly %x) {
18-
; CHECK: pushq %rax
19-
; CHECK-NOT: push %rbp
20-
; CHECK: callq __asan_check_load_add_2_[[REG2:.*]]
21-
; CHECK: callq __asan_check_store_add_2_[[REG2]]
22-
; CHECK-NOT: pop %rbp
23-
; CHECK: popq %rax
21+
define void @load2(i16* nocapture readonly %x) nounwind {
22+
; CHECK-LABEL: load2:
23+
; CHECK: # %bb.0:
24+
; CHECK-NEXT: pushq %rax
25+
; CHECK-NEXT: callq __asan_check_load_add_2_RDI
26+
; CHECK-NEXT: callq __asan_check_store_add_2_RDI
27+
; CHECK-NEXT: popq %rax
28+
; CHECK-NEXT: retq
2429
%1 = ptrtoint i16* %x to i64
2530
%2 = bitcast i16* %x to i8*
2631
call void @llvm.asan.check.memaccess(i8* %2, i32 2)
2732
call void @llvm.asan.check.memaccess(i8* %2, i32 34)
2833
ret void
2934
}
3035

31-
define void @load4(i32* nocapture readonly %x) {
32-
; CHECK: pushq %rax
33-
; CHECK-NOT: push %rbp
34-
; CHECK: callq __asan_check_load_add_4_[[REG4:.*]]
35-
; CHECK: callq __asan_check_store_add_4_[[REG4]]
36-
; CHECK-NOT: pop %rbp
37-
; CHECK: popq %rax
36+
define void @load4(i32* nocapture readonly %x) nounwind {
37+
; CHECK-LABEL: load4:
38+
; CHECK: # %bb.0:
39+
; CHECK-NEXT: pushq %rax
40+
; CHECK-NEXT: callq __asan_check_load_add_4_RDI
41+
; CHECK-NEXT: callq __asan_check_store_add_4_RDI
42+
; CHECK-NEXT: popq %rax
43+
; CHECK-NEXT: retq
3844
%1 = ptrtoint i32* %x to i64
3945
%2 = bitcast i32* %x to i8*
4046
call void @llvm.asan.check.memaccess(i8* %2, i32 4)
4147
call void @llvm.asan.check.memaccess(i8* %2, i32 36)
4248
ret void
4349
}
44-
define void @load8(i64* nocapture readonly %x) {
45-
; CHECK: pushq %rax
46-
; CHECK-NOT: push %rbp
47-
; CHECK: callq __asan_check_load_add_8_[[REG8:.*]]
48-
; CHECK: callq __asan_check_store_add_8_[[REG8]]
49-
; CHECK-NOT: pop %rbp
50-
; CHECK: popq %rax
50+
51+
define void @load8(i64* nocapture readonly %x) nounwind {
52+
; CHECK-LABEL: load8:
53+
; CHECK: # %bb.0:
54+
; CHECK-NEXT: pushq %rax
55+
; CHECK-NEXT: callq __asan_check_load_add_8_RDI
56+
; CHECK-NEXT: callq __asan_check_store_add_8_RDI
57+
; CHECK-NEXT: popq %rax
58+
; CHECK-NEXT: retq
5159
%1 = ptrtoint i64* %x to i64
5260
%2 = bitcast i64* %x to i8*
5361
call void @llvm.asan.check.memaccess(i8* %2, i32 6)
5462
call void @llvm.asan.check.memaccess(i8* %2, i32 38)
5563
ret void
5664
}
5765

58-
define void @load16(i128* nocapture readonly %x) {
59-
; CHECK: pushq %rax
60-
; CHECK-NOT: push %rbp
61-
; CHECK: callq __asan_check_load_add_16_[[REG16:.*]]
62-
; CHECK: callq __asan_check_store_add_16_[[REG16]]
63-
; CHECK-NOT: pop %rbp
64-
; CHECK: popq %rax
66+
define void @load16(i128* nocapture readonly %x) nounwind {
67+
; CHECK-LABEL: load16:
68+
; CHECK: # %bb.0:
69+
; CHECK-NEXT: pushq %rax
70+
; CHECK-NEXT: callq __asan_check_load_add_16_RDI
71+
; CHECK-NEXT: callq __asan_check_store_add_16_RDI
72+
; CHECK-NEXT: popq %rax
73+
; CHECK-NEXT: retq
6574
%1 = ptrtoint i128* %x to i64
6675
%2 = bitcast i128* %x to i8*
6776
call void @llvm.asan.check.memaccess(i8* %2, i32 8)

0 commit comments

Comments
 (0)