1 ; RUN: opt < %s -O0 -S | FileCheck %s
2 ; RUN: opt < %s -O1 -S | FileCheck %s
3 ; RUN: opt < %s -O2 -S | FileCheck %s
4 ; RUN: opt < %s -O3 -S | FileCheck %s
5 ; RUN: opt < %s -passes='default<O0>' -S | FileCheck %s
6 ; RUN: opt < %s -passes='default<O1>' -S | FileCheck %s
7 ; RUN: opt < %s -passes='default<O2>' -S | FileCheck %s
8 ; RUN: opt < %s -passes='default<O3>' -S | FileCheck %s
10 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
11 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
12 declare void @foo(i8* nocapture)
14 define void @asan() sanitize_address {
17 %text = alloca i8, align 1
19 call void @llvm.lifetime.start.p0i8(i64 1, i8* %text)
20 call void @llvm.lifetime.end.p0i8(i64 1, i8* %text)
21 ; CHECK: call void @llvm.lifetime.start
22 ; CHECK-NEXT: call void @llvm.lifetime.end
24 call void @foo(i8* %text) ; Keep alloca alive
29 define void @hwasan() sanitize_hwaddress {
31 ; CHECK-LABEL: @hwasan(
32 %text = alloca i8, align 1
34 call void @llvm.lifetime.start.p0i8(i64 1, i8* %text)
35 call void @llvm.lifetime.end.p0i8(i64 1, i8* %text)
36 ; CHECK: call void @llvm.lifetime.start
37 ; CHECK-NEXT: call void @llvm.lifetime.end
39 call void @foo(i8* %text) ; Keep alloca alive
44 define void @msan() sanitize_memory {
47 %text = alloca i8, align 1
49 call void @llvm.lifetime.start.p0i8(i64 1, i8* %text)
50 call void @llvm.lifetime.end.p0i8(i64 1, i8* %text)
51 ; CHECK: call void @llvm.lifetime.start
52 ; CHECK-NEXT: call void @llvm.lifetime.end
54 call void @foo(i8* %text) ; Keep alloca alive
59 define void @no_asan() {
61 ; CHECK-LABEL: @no_asan(
62 %text = alloca i8, align 1
64 call void @llvm.lifetime.start.p0i8(i64 1, i8* %text)
65 call void @llvm.lifetime.end.p0i8(i64 1, i8* %text)
66 ; CHECK-NO: call void @llvm.lifetime
68 call void @foo(i8* %text) ; Keep alloca alive