llvm.org GIT mirror llvm / 8784fb8
Add element-atomic mem intrinsic canary tests for Memory Sanitizer. Summary: Add canary tests to verify that MSAN currently does nothing with the element atomic memory intrinsics for memcpy, memmove, and memset. Placeholder tests that will fail once element atomic @llvm.mem[cpy|move|set] instrinsics have been added to the MemIntrinsic class hierarchy. These will act as a reminder to verify that MSAN handles these intrinsics properly once they have been added to that class hierarchy. Reviewers: reames Reviewed By: reames Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35510 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308251 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Neilson 2 years ago
1 changed file(s) with 35 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
236236 ; CHECK-LABEL: @MemMove
237237 ; CHECK: call i8* @__msan_memmove
238238 ; CHECK: ret void
239
240 ;; ------------
241 ;; Placeholder tests that will fail once element atomic @llvm.mem[cpy|move|set] instrinsics have
242 ;; been added to the MemIntrinsic class hierarchy. These will act as a reminder to
243 ;; verify that MSAN handles these intrinsics properly once they have been
244 ;; added to that class hierarchy.
245 declare void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* nocapture writeonly, i8, i64, i32) nounwind
246 declare void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32) nounwind
247 declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32) nounwind
248
249 define void @atomic_memcpy(i8* nocapture %x, i8* nocapture %y) nounwind {
250 ; CHECK-LABEL: atomic_memcpy
251 ; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 2 %y, i64 16, i32 1)
252 ; CHECK-NEXT: ret void
253 call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 2 %y, i64 16, i32 1)
254 ret void
255 }
256
257 define void @atomic_memmove(i8* nocapture %x, i8* nocapture %y) nounwind {
258 ; CHECK-LABEL: atomic_memmove
259 ; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 2 %y, i64 16, i32 1)
260 ; CHECK-NEXT: ret void
261 call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 2 %y, i64 16, i32 1)
262 ret void
263 }
264
265 define void @atomic_memset(i8* nocapture %x) nounwind {
266 ; CHECK-LABEL: atomic_memset
267 ; CHECK-NEXT: call void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* align 1 %x, i8 88, i64 16, i32 1)
268 ; CHECK-NEXT: ret void
269 call void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* align 1 %x, i8 88, i64 16, i32 1)
270 ret void
271 }
272
273 ;; ------------
239274
240275
241276 ; Check that we propagate shadow for "select"