1 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
4 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
5 declare void @foo(i8* nocapture)
7 define void @asan() sanitize_address {
10 %text = alloca i8, align 1
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
17 call void @foo(i8* %text) ; Keep alloca alive
22 define void @hwasan() sanitize_hwaddress {
24 ; CHECK-LABEL: @hwasan(
25 %text = alloca i8, align 1
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
32 call void @foo(i8* %text) ; Keep alloca alive
37 define void @msan() sanitize_memory {
40 %text = alloca i8, align 1
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
47 call void @foo(i8* %text) ; Keep alloca alive
52 define void @no_asan() {
54 ; CHECK-LABEL: @no_asan(
55 %text = alloca i8, align 1
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
61 call void @foo(i8* %text) ; Keep alloca alive