1 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3 declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
4 declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
5 declare void @foo(ptr nocapture)
7 define void @asan() sanitize_address {
10 %text = alloca i8, align 1
12 call void @llvm.lifetime.start.p0(i64 1, ptr %text)
13 call void @llvm.lifetime.end.p0(i64 1, ptr %text)
14 ; CHECK: call void @llvm.lifetime.start
15 ; CHECK-NEXT: call void @llvm.lifetime.end
17 call void @foo(ptr %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.p0(i64 1, ptr %text)
28 call void @llvm.lifetime.end.p0(i64 1, ptr %text)
29 ; CHECK: call void @llvm.lifetime.start
30 ; CHECK-NEXT: call void @llvm.lifetime.end
32 call void @foo(ptr %text) ; Keep alloca alive
37 define void @msan() sanitize_memory {
40 %text = alloca i8, align 1
42 call void @llvm.lifetime.start.p0(i64 1, ptr %text)
43 call void @llvm.lifetime.end.p0(i64 1, ptr %text)
44 ; CHECK: call void @llvm.lifetime.start
45 ; CHECK-NEXT: call void @llvm.lifetime.end
47 call void @foo(ptr %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.p0(i64 1, ptr %text)
58 call void @llvm.lifetime.end.p0(i64 1, ptr %text)
59 ; CHECK-NO: call void @llvm.lifetime
61 call void @foo(ptr %text) ; Keep alloca alive