llvm.org GIT mirror llvm / a0b0701
Add element-atomic mem intrinsic canary tests for Address Sanitizer. Summary: Add canary tests to verify that ASAN 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 ASAN 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/D35505 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308248 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Neilson 2 years ago
1 changed file(s) with 20 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
169169 ; CHECK: __asan_memcpy
170170 ; CHECK: ret void
171171
172 declare void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* nocapture writeonly, i8, i64, i32) nounwind
173 declare void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32) nounwind
174 declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32) nounwind
175
176 define void @memintr_element_atomic_test(i8* %a, i8* %b) nounwind uwtable sanitize_address {
177 ; This is a canary test to make sure that these don't get lowered into calls that don't
178 ; have the element-atomic property. Eventually, asan will have to be enhanced to lower
179 ; these properly.
180 ; CHECK-LABEL: memintr_element_atomic_test
181 ; CHECK-NEXT: tail call void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* align 1 %a, i8 0, i64 100, i32 1)
182 ; CHECK-NEXT: tail call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %a, i8* align 1 %b, i64 100, i32 1)
183 ; CHECK-NEXT: tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %a, i8* align 1 %b, i64 100, i32 1)
184 ; CHECK-NEXT: ret void
185 tail call void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* align 1 %a, i8 0, i64 100, i32 1)
186 tail call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %a, i8* align 1 %b, i64 100, i32 1)
187 tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %a, i8* align 1 %b, i64 100, i32 1)
188 ret void
189 }
190
191
172192 ; CHECK-LABEL: @test_swifterror
173193 ; CHECK-NOT: __asan_report_load
174194 ; CHECK: ret void