[llvm] 90e7578 - [test] Test StackSafetyAnalysis handles MemIntrinsic even in the presence of __asan_memcpy

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 6 18:17:20 PST 2024


Author: Fangrui Song
Date: 2024-01-06T18:17:15-08:00
New Revision: 90e7578a56704eff2143beb8fbe99e05b0a3bb24

URL: https://github.com/llvm/llvm-project/commit/90e7578a56704eff2143beb8fbe99e05b0a3bb24
DIFF: https://github.com/llvm/llvm-project/commit/90e7578a56704eff2143beb8fbe99e05b0a3bb24.diff

LOG: [test] Test StackSafetyAnalysis handles MemIntrinsic even in the presence of __asan_memcpy

Added: 
    

Modified: 
    llvm/test/Instrumentation/AddressSanitizer/asan-stack-safety.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Instrumentation/AddressSanitizer/asan-stack-safety.ll b/llvm/test/Instrumentation/AddressSanitizer/asan-stack-safety.ll
index 9ba2dce6145f86..02c58a1f492261 100644
--- a/llvm/test/Instrumentation/AddressSanitizer/asan-stack-safety.ll
+++ b/llvm/test/Instrumentation/AddressSanitizer/asan-stack-safety.ll
@@ -50,3 +50,21 @@ define void @cmpxchg(i8 %compare_to, i8 %new_value) sanitize_address {
   ; NOSAFETY: call void @__asan_store1
   ret void
 }
+
+%struct.S = type { i32, i32 }
+
+; CHECK-LABEL: define %struct.S @exchange(
+; NOSAFETY: call i64 @__asan_stack_malloc
+; CHECK:    call ptr @__asan_memcpy(
+; CHECK:    call ptr @__asan_memcpy(
+; NOSAFETY: call void @__asan_loadN(
+define %struct.S @exchange(ptr %a, ptr %b) sanitize_address {
+entry:
+  %tmp = alloca %struct.S, align 4
+  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %tmp, ptr align 4 %a, i64 8, i1 false)
+  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a, ptr align 4 %b, i64 8, i1 false)
+  %ret = load %struct.S, ptr %tmp
+  ret %struct.S %ret
+}
+
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) nounwind


        


More information about the llvm-commits mailing list