1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
2 ; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
4 declare void @llvm.lifetime.start.p0(i64, ptr)
5 declare void @llvm.lifetime.end.p0(i64, ptr)
7 declare void @escape(ptr)
9 declare void @throwing_callee_foo()
10 declare void @throwing_callee_bar()
12 declare i32 @__gxx_personality_v0(...)
14 define void @caller(i1 %c) personality ptr @__gxx_personality_v0 {
15 ; CHECK-LABEL: @caller(
17 ; CHECK-NEXT: [[I0:%.*]] = alloca i32, align 4
18 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr nonnull [[I0]])
19 ; CHECK-NEXT: call void @escape(ptr [[I0]])
20 ; CHECK-NEXT: [[I2:%.*]] = alloca i32, align 4
21 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr nonnull [[I2]])
22 ; CHECK-NEXT: call void @escape(ptr [[I2]])
23 ; CHECK-NEXT: [[I4:%.*]] = alloca i32, align 4
24 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr nonnull [[I4]])
25 ; CHECK-NEXT: call void @escape(ptr [[I4]])
26 ; CHECK-NEXT: [[I6:%.*]] = alloca i32, align 4
27 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr nonnull [[I6]])
28 ; CHECK-NEXT: call void @escape(ptr [[I6]])
29 ; CHECK-NEXT: br i1 [[C:%.*]], label [[V0:%.*]], label [[V1:%.*]]
31 ; CHECK-NEXT: call void @throwing_callee_foo()
32 ; CHECK-NEXT: unreachable
34 ; CHECK-NEXT: call void @throwing_callee_bar()
35 ; CHECK-NEXT: unreachable
39 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i0)
40 call void @escape(ptr %i0)
43 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i2)
44 call void @escape(ptr %i2)
47 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i4)
48 call void @escape(ptr %i4)
51 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i6)
52 call void @escape(ptr %i6)
54 br i1 %c, label %v0, label %v1
57 invoke void @throwing_callee_foo()
58 to label %invoke.cont unwind label %lpad.v0
61 invoke void @throwing_callee_bar()
62 to label %invoke.cont unwind label %lpad.v1
68 %i8 = landingpad { ptr, i32 } cleanup
69 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i0)
73 %i9 = landingpad { ptr, i32 } cleanup
74 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i2)
78 %i10 = phi { ptr, i32 } [ %i8, %lpad.v0 ], [ %i9, %lpad.v1 ]
79 %i11 = phi ptr [ %i4, %lpad.v0 ], [ %i6, %lpad.v1 ]
80 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i11)
81 resume { ptr, i32 } %i10
84 ; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }