74 lines · plain
1; RUN: opt < %s -O0 -S | FileCheck %s --check-prefixes=CHECK,NOOPT2; RUN: opt < %s -O1 -S | FileCheck %s --check-prefixes=CHECK,OPT3; RUN: opt < %s -O2 -S | FileCheck %s --check-prefixes=CHECK,OPT4; RUN: opt < %s -O3 -S | FileCheck %s --check-prefixes=CHECK,OPT5; RUN: opt < %s -passes='default<O0>' -S | FileCheck %s --check-prefixes=CHECK,NOOPT6; RUN: opt < %s -passes='default<O1>' -S | FileCheck %s --check-prefixes=CHECK,OPT7; RUN: opt < %s -passes='default<O2>' -S | FileCheck %s --check-prefixes=CHECK,OPT8; RUN: opt < %s -passes="default<O3>" -S | FileCheck %s --check-prefixes=CHECK,OPT9 10declare void @llvm.lifetime.start.p0(ptr nocapture)11declare void @llvm.lifetime.end.p0(ptr nocapture)12declare void @foo(ptr nocapture)13 14define void @asan() sanitize_address {15entry:16 ; CHECK-LABEL: @asan(17 %text = alloca i8, align 118 19 call void @llvm.lifetime.start.p0(ptr %text)20 call void @llvm.lifetime.end.p0(ptr %text)21 ; CHECK: call void @llvm.lifetime.start22 ; CHECK-NEXT: call void @llvm.lifetime.end23 24 call void @foo(ptr %text) ; Keep alloca alive25 26 ret void27}28 29define void @hwasan() sanitize_hwaddress {30entry:31 ; CHECK-LABEL: @hwasan(32 %text = alloca i8, align 133 34 call void @llvm.lifetime.start.p0(ptr %text)35 call void @llvm.lifetime.end.p0(ptr %text)36 ; CHECK: call void @llvm.lifetime.start37 ; CHECK-NEXT: call void @llvm.lifetime.end38 39 call void @foo(ptr %text) ; Keep alloca alive40 41 ret void42}43 44define void @msan() sanitize_memory {45entry:46 ; CHECK-LABEL: @msan(47 %text = alloca i8, align 148 49 call void @llvm.lifetime.start.p0(ptr %text)50 call void @llvm.lifetime.end.p0(ptr %text)51 ; CHECK: call void @llvm.lifetime.start52 ; CHECK-NEXT: call void @llvm.lifetime.end53 54 call void @foo(ptr %text) ; Keep alloca alive55 56 ret void57}58 59define void @no_asan() {60entry:61 ; CHECK-LABEL: @no_asan(62 %text = alloca i8, align 163 64 call void @llvm.lifetime.start.p0(ptr %text)65 call void @llvm.lifetime.end.p0(ptr %text)66 ; OPT-NOT: call void @llvm.lifetime67 ; NOOPT: call void @llvm.lifetime.start68 ; NOOPT-NEXT: call void @llvm.lifetime.end69 70 call void @foo(ptr %text) ; Keep alloca alive71 72 ret void73}74