1 ; RUN: opt -S -passes=hwasan -hwasan-use-stack-safety=0 %s | FileCheck --check-prefixes=CHECK,CHECK-PREFIX %s
2 ; RUN: opt -S -passes=hwasan -hwasan-kernel -hwasan-use-stack-safety=0 %s | FileCheck --check-prefixes=CHECK,CHECK-NOPREFIX %s
3 ; RUN: opt -S -passes=hwasan -hwasan-kernel -hwasan-kernel-mem-intrinsic-prefix -hwasan-use-stack-safety=0 %s | FileCheck --check-prefixes=CHECK,CHECK-PREFIX %s
4 ; RUN: opt -S -passes=hwasan -hwasan-use-stack-safety=0 -hwasan-match-all-tag=0 %s | FileCheck --check-prefixes=CHECK,CHECK-MATCH-ALL-TAG %s
6 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-unknown-linux-gnu"
9 ; Function Attrs: noinline nounwind optnone uwtable
10 define dso_local i32 @main() sanitize_hwaddress {
13 %retval = alloca i32, align 4
14 %Q = alloca [10 x i8], align 1
15 %P = alloca [10 x i8], align 1
16 store i32 0, ptr %retval, align 4
18 call void @llvm.memset.p0.i64(ptr align 1 %Q, i8 0, i64 10, i1 false)
19 ; CHECK-PREFIX: call ptr @__hwasan_memset(
20 ; CHECK-NOPREFIX: call ptr @memset(
21 ; CHECK-MATCH-ALL-TAG: call ptr @__hwasan_memset_match_all(ptr %Q.hwasan, i32 0, i64 10, i8 0)
23 %add.ptr = getelementptr inbounds i8, ptr %Q, i64 5
25 call void @llvm.memmove.p0.p0.i64(ptr align 1 %Q, ptr align 1 %add.ptr, i64 5, i1 false)
26 ; CHECK-PREFIX: call ptr @__hwasan_memmove(
27 ; CHECK-NOPREFIX: call ptr @memmove(
28 ; CHECK-MATCH-ALL-TAG: call ptr @__hwasan_memmove_match_all(ptr %Q.hwasan, ptr %add.ptr, i64 5, i8 0)
31 call void @llvm.memcpy.p0.p0.i64(ptr align 1 %P, ptr align 1 %Q, i64 10, i1 false)
32 ; CHECK-PREFIX: call ptr @__hwasan_memcpy(
33 ; CHECK-NOPREFIX: call ptr @memcpy(
34 ; CHECK-MATCH-ALL-TAG: call ptr @__hwasan_memcpy_match_all(ptr %P.hwasan, ptr %Q.hwasan, i64 10, i8 0)
38 ; Function Attrs: argmemonly nounwind
39 declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1) #1
41 ; Function Attrs: argmemonly nounwind
42 declare void @llvm.memmove.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) #1
44 ; Function Attrs: argmemonly nounwind
45 declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1) #1
47 define void @memintr_test_nosanitize(ptr %a, ptr %b) nounwind uwtable {
49 tail call void @llvm.memset.p0.i64(ptr %a, i8 0, i64 100, i1 false)
50 tail call void @llvm.memmove.p0.p0.i64(ptr %a, ptr %b, i64 100, i1 false)
51 tail call void @llvm.memcpy.p0.p0.i64(ptr %a, ptr %b, i64 100, i1 false)
54 ; CHECK-LABEL: memintr_test_nosanitize
56 ; CHECK: @llvm.memmove