Skip to content

Commit 9ef17e7

Browse files
gbaraldimaleadt
authored andcommitted
Add patches for msan
1 parent cecf0f8 commit 9ef17e7

File tree

1 file changed

+30
-0
lines changed
  • llvm/test/Instrumentation/MemorySanitizer

1 file changed

+30
-0
lines changed

llvm/test/Instrumentation/MemorySanitizer/alloca.ll

+30
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ entry:
7272
; KMSAN: call void @__msan_poison_alloca(ptr {{.*}}, i64 20,
7373
; CHECK: ret void
7474

75+
define void @array32() sanitize_memory {
76+
entry:
77+
%x = alloca i32, i32 5, align 4
78+
ret void
79+
}
80+
81+
; CHECK-LABEL: define void @array32(
82+
; INLINE: call void @llvm.memset.p0i8.i64(i8* align 4 {{.*}}, i8 -1, i64 20, i1 false)
83+
; CALL: call void @__msan_poison_stack(i8* {{.*}}, i64 20)
84+
; ORIGIN: call void @__msan_set_alloca_origin_with_descr(i8* {{.*}}, i64 20,
85+
; ORIGIN-LEAN: call void @__msan_set_alloca_origin_no_descr(i8* {{.*}}, i64 20,
86+
; KMSAN: call void @__msan_poison_alloca(i8* {{.*}}, i64 20,
87+
; CHECK: ret void
88+
7589
define void @array_non_const(i64 %cnt) sanitize_memory {
7690
entry:
7791
%x = alloca i32, i64 %cnt, align 4
@@ -103,6 +117,22 @@ entry:
103117
; KMSAN: call void @__msan_poison_alloca(ptr {{.*}}, i64 %[[A]],
104118
; CHECK: ret void
105119

120+
define void @array_non_const32(i32 %cnt) sanitize_memory {
121+
entry:
122+
%x = alloca i32, i32 %cnt, align 4
123+
ret void
124+
}
125+
126+
; CHECK-LABEL: define void @array_non_const32(
127+
; CHECK: %[[Z:.*]] = zext i32 %cnt to i64
128+
; CHECK: %[[A:.*]] = mul i64 4, %[[Z]]
129+
; INLINE: call void @llvm.memset.p0i8.i64(i8* align 4 {{.*}}, i8 -1, i64 %[[A]], i1 false)
130+
; CALL: call void @__msan_poison_stack(i8* {{.*}}, i64 %[[A]])
131+
; ORIGIN: call void @__msan_set_alloca_origin_with_descr(i8* {{.*}}, i64 %[[A]],
132+
; ORIGIN-LEAN: call void @__msan_set_alloca_origin_no_descr(i8* {{.*}}, i64 %[[A]],
133+
; KMSAN: call void @__msan_poison_alloca(i8* {{.*}}, i64 %[[A]],
134+
; CHECK: ret void
135+
106136
; Check that the local is unpoisoned in the absence of sanitize_memory
107137
define void @unpoison_local() {
108138
entry:

0 commit comments

Comments
 (0)