• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -hwasan %s | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6; Function Attrs: noinline nounwind optnone uwtable
7define dso_local i32 @main() sanitize_hwaddress {
8entry:
9  %retval = alloca i32, align 4
10  %Q = alloca [10 x i8], align 1
11  %P = alloca [10 x i8], align 1
12  store i32 0, i32* %retval, align 4
13  %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %Q, i32 0, i32 0
14
15  call void @llvm.memset.p0i8.i64(i8* align 1 %arraydecay, i8 0, i64 10, i1 false)
16; CHECK: call i8* @__hwasan_memset
17
18  %arraydecay1 = getelementptr inbounds [10 x i8], [10 x i8]* %Q, i32 0, i32 0
19  %arraydecay2 = getelementptr inbounds [10 x i8], [10 x i8]* %Q, i32 0, i32 0
20  %add.ptr = getelementptr inbounds i8, i8* %arraydecay2, i64 5
21
22  call void @llvm.memmove.p0i8.p0i8.i64(i8* align 1 %arraydecay1, i8* align 1 %add.ptr, i64 5, i1 false)
23; CHECK: call i8* @__hwasan_memmove
24
25  %arraydecay3 = getelementptr inbounds [10 x i8], [10 x i8]* %P, i32 0, i32 0
26  %arraydecay4 = getelementptr inbounds [10 x i8], [10 x i8]* %Q, i32 0, i32 0
27
28  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %arraydecay3, i8* align 1 %arraydecay4, i64 10, i1 false)
29; CHECK: call i8* @__hwasan_memcpy
30  ret i32 0
31}
32
33; Function Attrs: argmemonly nounwind
34declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) #1
35
36; Function Attrs: argmemonly nounwind
37declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #1
38
39; Function Attrs: argmemonly nounwind
40declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #1
41