[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / Transforms / PhaseOrdering / lifetime-sanitizer.ll
blob1239b18c0701724b277fdf3dd7943bc7fb9f6998
1 ; RUN: opt < %s -O0 -S | FileCheck %s --check-prefixes=CHECK,NOOPT
2 ; RUN: opt < %s -O1 -S | FileCheck %s --check-prefixes=CHECK,OPT
3 ; RUN: opt < %s -O2 -S | FileCheck %s --check-prefixes=CHECK,OPT
4 ; RUN: opt < %s -O3 -S | FileCheck %s --check-prefixes=CHECK,OPT
5 ; RUN: opt < %s -passes='default<O0>' -S | FileCheck %s --check-prefixes=CHECK,NOOPT
6 ; RUN: opt < %s -passes='default<O1>' -S | FileCheck %s --check-prefixes=CHECK,OPT
7 ; RUN: opt < %s -passes='default<O2>' -S | FileCheck %s --check-prefixes=CHECK,OPT
8 ; RUN: opt < %s -passes="default<O3>" -S | FileCheck %s --check-prefixes=CHECK,OPT
10 declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
11 declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
12 declare void @foo(ptr nocapture)
14 define void @asan() sanitize_address {
15 entry:
16   ; CHECK-LABEL: @asan(
17   %text = alloca i8, align 1
19   call void @llvm.lifetime.start.p0(i64 1, ptr %text)
20   call void @llvm.lifetime.end.p0(i64 1, ptr %text)
21   ; CHECK: call void @llvm.lifetime.start
22   ; CHECK-NEXT: call void @llvm.lifetime.end
24   call void @foo(ptr %text) ; Keep alloca alive
26   ret void
29 define void @hwasan() sanitize_hwaddress {
30 entry:
31   ; CHECK-LABEL: @hwasan(
32   %text = alloca i8, align 1
34   call void @llvm.lifetime.start.p0(i64 1, ptr %text)
35   call void @llvm.lifetime.end.p0(i64 1, ptr %text)
36   ; CHECK: call void @llvm.lifetime.start
37   ; CHECK-NEXT: call void @llvm.lifetime.end
39   call void @foo(ptr %text) ; Keep alloca alive
41   ret void
44 define void @msan() sanitize_memory {
45 entry:
46   ; CHECK-LABEL: @msan(
47   %text = alloca i8, align 1
49   call void @llvm.lifetime.start.p0(i64 1, ptr %text)
50   call void @llvm.lifetime.end.p0(i64 1, ptr %text)
51   ; CHECK: call void @llvm.lifetime.start
52   ; CHECK-NEXT: call void @llvm.lifetime.end
54   call void @foo(ptr %text) ; Keep alloca alive
56   ret void
59 define void @no_asan() {
60 entry:
61   ; CHECK-LABEL: @no_asan(
62   %text = alloca i8, align 1
64   call void @llvm.lifetime.start.p0(i64 1, ptr %text)
65   call void @llvm.lifetime.end.p0(i64 1, ptr %text)
66   ; OPT-NOT:    call void @llvm.lifetime
67   ; NOOPT:      call void @llvm.lifetime.start
68   ; NOOPT-NEXT: call void @llvm.lifetime.end
70   call void @foo(ptr %text) ; Keep alloca alive
72   ret void