1; RUN: opt < %s -instcombine -S | FileCheck %s 2 3declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) 4declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) 5declare void @foo(i8* nocapture) 6 7define void @asan() sanitize_address { 8entry: 9 ; CHECK-LABEL: @asan( 10 %text = alloca i8, align 1 11 12 call void @llvm.lifetime.start.p0i8(i64 1, i8* %text) 13 call void @llvm.lifetime.end.p0i8(i64 1, i8* %text) 14 ; CHECK: call void @llvm.lifetime.start 15 ; CHECK-NEXT: call void @llvm.lifetime.end 16 17 call void @foo(i8* %text) ; Keep alloca alive 18 19 ret void 20} 21 22define void @hwasan() sanitize_hwaddress { 23entry: 24 ; CHECK-LABEL: @hwasan( 25 %text = alloca i8, align 1 26 27 call void @llvm.lifetime.start.p0i8(i64 1, i8* %text) 28 call void @llvm.lifetime.end.p0i8(i64 1, i8* %text) 29 ; CHECK: call void @llvm.lifetime.start 30 ; CHECK-NEXT: call void @llvm.lifetime.end 31 32 call void @foo(i8* %text) ; Keep alloca alive 33 34 ret void 35} 36 37define void @msan() sanitize_memory { 38entry: 39 ; CHECK-LABEL: @msan( 40 %text = alloca i8, align 1 41 42 call void @llvm.lifetime.start.p0i8(i64 1, i8* %text) 43 call void @llvm.lifetime.end.p0i8(i64 1, i8* %text) 44 ; CHECK: call void @llvm.lifetime.start 45 ; CHECK-NEXT: call void @llvm.lifetime.end 46 47 call void @foo(i8* %text) ; Keep alloca alive 48 49 ret void 50} 51 52define void @no_asan() { 53entry: 54 ; CHECK-LABEL: @no_asan( 55 %text = alloca i8, align 1 56 57 call void @llvm.lifetime.start.p0i8(i64 1, i8* %text) 58 call void @llvm.lifetime.end.p0i8(i64 1, i8* %text) 59 ; CHECK-NO: call void @llvm.lifetime 60 61 call void @foo(i8* %text) ; Keep alloca alive 62 63 ret void 64} 65