• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -instcombine -S | FileCheck %s
2
3declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
4declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
5declare void @foo(i8* nocapture)
6
7define void @asan() sanitize_address {
8entry:
9  ; CHECK-LABEL: @asan(
10  %text = alloca i8, align 1
11
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
16
17  call void @foo(i8* %text) ; Keep alloca alive
18
19  ret void
20}
21
22define void @hwasan() sanitize_hwaddress {
23entry:
24  ; CHECK-LABEL: @hwasan(
25  %text = alloca i8, align 1
26
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
31
32  call void @foo(i8* %text) ; Keep alloca alive
33
34  ret void
35}
36
37define void @no_asan() {
38entry:
39  ; CHECK-LABEL: @no_asan(
40  %text = alloca i8, align 1
41
42  call void @llvm.lifetime.start.p0i8(i64 1, i8* %text)
43  call void @llvm.lifetime.end.p0i8(i64 1, i8* %text)
44  ; CHECK-NO: call void @llvm.lifetime
45
46  call void @foo(i8* %text) ; Keep alloca alive
47
48  ret void
49}
50