1; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s --check-prefixes=CHECK,INLINE 2; RUN: opt < %s -msan -msan-check-access-address=0 -msan-poison-stack-with-call=1 -S | FileCheck %s --check-prefixes=CHECK,CALL 3; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s --check-prefixes=CHECK,ORIGIN 4; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s --check-prefixes=CHECK,ORIGIN 5 6target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 7target triple = "x86_64-unknown-linux-gnu" 8 9define void @static() sanitize_memory { 10entry: 11 %x = alloca i32, align 4 12 ret void 13} 14 15; CHECK-LABEL: define void @static( 16; INLINE: call void @llvm.memset.p0i8.i64(i8* align 4 {{.*}}, i8 -1, i64 4, i1 false) 17; CALL: call void @__msan_poison_stack(i8* {{.*}}, i64 4) 18; ORIGIN: call void @__msan_set_alloca_origin4(i8* {{.*}}, i64 4, 19; CHECK: ret void 20 21 22define void @dynamic() sanitize_memory { 23entry: 24 br label %l 25l: 26 %x = alloca i32, align 4 27 ret void 28} 29 30; CHECK-LABEL: define void @dynamic( 31; INLINE: call void @llvm.memset.p0i8.i64(i8* align 4 {{.*}}, i8 -1, i64 4, i1 false) 32; CALL: call void @__msan_poison_stack(i8* {{.*}}, i64 4) 33; ORIGIN: call void @__msan_set_alloca_origin4(i8* {{.*}}, i64 4, 34; CHECK: ret void 35 36define void @array() sanitize_memory { 37entry: 38 %x = alloca i32, i64 5, align 4 39 ret void 40} 41 42; CHECK-LABEL: define void @array( 43; INLINE: call void @llvm.memset.p0i8.i64(i8* align 4 {{.*}}, i8 -1, i64 20, i1 false) 44; CALL: call void @__msan_poison_stack(i8* {{.*}}, i64 20) 45; ORIGIN: call void @__msan_set_alloca_origin4(i8* {{.*}}, i64 20, 46; CHECK: ret void 47 48define void @array_non_const(i64 %cnt) sanitize_memory { 49entry: 50 %x = alloca i32, i64 %cnt, align 4 51 ret void 52} 53 54; CHECK-LABEL: define void @array_non_const( 55; CHECK: %[[A:.*]] = mul i64 4, %cnt 56; INLINE: call void @llvm.memset.p0i8.i64(i8* align 4 {{.*}}, i8 -1, i64 %[[A]], i1 false) 57; CALL: call void @__msan_poison_stack(i8* {{.*}}, i64 %[[A]]) 58; ORIGIN: call void @__msan_set_alloca_origin4(i8* {{.*}}, i64 %[[A]], 59; CHECK: ret void 60