llvm.org GIT mirror llvm / b75041b
Add element-atomic mem intrinsic canary tests for Efficiency Sanitizer. Summary: Add canary tests to verify that ESAN 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 ESAN 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/D35508 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308250 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Neilson 2 years ago
2 changed file(s) with 65 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
233233 }
234234
235235 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
236 ; Ensure that esan doesn't convert element atomic memory intrinsics to
237 ; calls.
238
239 declare void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* nocapture writeonly, i8, i64, i32) nounwind
240 declare void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32) nounwind
241 declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32) nounwind
242
243 define void @elementAtomic_memCpyTest(i8* nocapture %x, i8* nocapture %y) {
244 ; CHECK-LABEL: elementAtomic_memCpyTest
245 ; CHECK-NEXT: tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 1 %y, i64 16, i32 1)
246 ; CHECK-NEXT: ret void
247 tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 1 %y, i64 16, i32 1)
248 ret void
249 }
250
251 define void @elementAtomic_memMoveTest(i8* nocapture %x, i8* nocapture %y) {
252 ; CHECK-LABEL: elementAtomic_memMoveTest
253 ; CHECK-NEXT: tail call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 1 %y, i64 16, i32 1)
254 ; CHECK-NEXT: ret void
255 tail call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 1 %y, i64 16, i32 1)
256 ret void
257 }
258
259 define void @elementAtomic_memSetTest(i8* nocapture %x) {
260 ; CHECK-LABEL: elementAtomic_memSetTest
261 ; CHECK-NEXT: tail call void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* align 1 %x, i8 77, i64 16, i32 1)
262 ; CHECK-NEXT: ret void
263 tail call void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* align 1 %x, i8 77, i64 16, i32 1)
264 ret void
265 }
266
267
268 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
236269 ; Top-level:
237270
238271 ; CHECK: define internal void @esan.module_ctor()
250250 }
251251
252252 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
253 ; Ensure that esan doesn't convert element atomic memory intrinsics to
254 ; calls.
255
256 declare void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* nocapture writeonly, i8, i64, i32) nounwind
257 declare void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32) nounwind
258 declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32) nounwind
259
260 define void @elementAtomic_memCpyTest(i8* nocapture %x, i8* nocapture %y) {
261 ; CHECK-LABEL: elementAtomic_memCpyTest
262 ; CHECK-NEXT: tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 1 %y, i64 16, i32 1)
263 ; CHECK-NEXT: ret void
264 tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 1 %y, i64 16, i32 1)
265 ret void
266 }
267
268 define void @elementAtomic_memMoveTest(i8* nocapture %x, i8* nocapture %y) {
269 ; CHECK-LABEL: elementAtomic_memMoveTest
270 ; CHECK-NEXT: tail call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 1 %y, i64 16, i32 1)
271 ; CHECK-NEXT: ret void
272 tail call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %x, i8* align 1 %y, i64 16, i32 1)
273 ret void
274 }
275
276 define void @elementAtomic_memSetTest(i8* nocapture %x) {
277 ; CHECK-LABEL: elementAtomic_memSetTest
278 ; CHECK-NEXT: tail call void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* align 1 %x, i8 77, i64 16, i32 1)
279 ; CHECK-NEXT: ret void
280 tail call void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* align 1 %x, i8 77, i64 16, i32 1)
281 ret void
282 }
283
284 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
253285 ; Top-level:
254286
255287 ; CHECK: define internal void @esan.module_ctor()