xref: /llvm-project/llvm/test/Transforms/Inline/crash-lifetime-marker.ll (revision 151602c7a9935558ca671b35359989b261045db0)
1; RUN: opt < %s -passes=inline -S | FileCheck %s
2; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s
3; RUN: opt < %s -passes='module-inline' -S | FileCheck %s
4
5; InlineFunction would assert inside the loop that leaves lifetime markers if
6; there was an zero-sized AllocaInst. Check that it doesn't assert and doesn't
7; leave lifetime markers in that case.
8
9declare i32 @callee2(ptr)
10
11define i32 @callee1(i32 %count) {
12  %a0 = alloca i8, i32 %count, align 4
13  %call0 = call i32 @callee2(ptr %a0)
14  ret i32 %call0
15}
16
17; CHECK-LABEL: define i32 @caller1(
18; CHECK: [[ALLOCA:%[a-z0-9\.]+]] = alloca i8
19; CHECK-NOT: call void @llvm.lifetime.start.p0(
20; CHECK: call i32 @callee2(ptr [[ALLOCA]])
21; CHECK-NOT: call void @llvm.lifetime.end.p0(
22
23define i32 @caller1(i32 %count) {
24  %call0 = call i32 @callee1(i32 0)
25  ret i32 %call0
26}
27