1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
4 declare void @llvm.lifetime.start.p0i8(i64, i8*)
5 declare void @llvm.lifetime.end.p0i8(i64, i8*)
7 declare void @escape(i32*)
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 i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
15 ; CHECK-LABEL: @caller(
17 ; CHECK-NEXT: [[I0:%.*]] = alloca i32, align 4
18 ; CHECK-NEXT: [[I1:%.*]] = bitcast i32* [[I0]] to i8*
19 ; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull [[I1]])
20 ; CHECK-NEXT: call void @escape(i32* [[I0]])
21 ; CHECK-NEXT: [[I2:%.*]] = alloca i32, align 4
22 ; CHECK-NEXT: [[I3:%.*]] = bitcast i32* [[I2]] to i8*
23 ; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull [[I3]])
24 ; CHECK-NEXT: call void @escape(i32* [[I2]])
25 ; CHECK-NEXT: [[I4:%.*]] = alloca i32, align 4
26 ; CHECK-NEXT: [[I5:%.*]] = bitcast i32* [[I4]] to i8*
27 ; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull [[I5]])
28 ; CHECK-NEXT: call void @escape(i32* [[I4]])
29 ; CHECK-NEXT: [[I6:%.*]] = alloca i32, align 4
30 ; CHECK-NEXT: [[I7:%.*]] = bitcast i32* [[I6]] to i8*
31 ; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull [[I7]])
32 ; CHECK-NEXT: call void @escape(i32* [[I6]])
33 ; CHECK-NEXT: br i1 [[C:%.*]], label [[V0:%.*]], label [[V1:%.*]]
35 ; CHECK-NEXT: call void @throwing_callee_foo()
36 ; CHECK-NEXT: unreachable
38 ; CHECK-NEXT: call void @throwing_callee_bar()
39 ; CHECK-NEXT: unreachable
43 %i1 = bitcast i32* %i0 to i8*
44 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %i1)
45 call void @escape(i32* %i0)
48 %i3 = bitcast i32* %i2 to i8*
49 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %i3)
50 call void @escape(i32* %i2)
53 %i5 = bitcast i32* %i4 to i8*
54 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %i5)
55 call void @escape(i32* %i4)
58 %i7 = bitcast i32* %i6 to i8*
59 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %i7)
60 call void @escape(i32* %i6)
62 br i1 %c, label %v0, label %v1
65 invoke void @throwing_callee_foo()
66 to label %invoke.cont unwind label %lpad.v0
69 invoke void @throwing_callee_bar()
70 to label %invoke.cont unwind label %lpad.v1
76 %i8 = landingpad { i8*, i32 } cleanup
77 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %i1)
81 %i9 = landingpad { i8*, i32 } cleanup
82 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %i3)
86 %i10 = phi { i8*, i32 } [ %i8, %lpad.v0 ], [ %i9, %lpad.v1 ]
87 %i11 = phi i8* [ %i5, %lpad.v0 ], [ %i7, %lpad.v1 ]
88 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %i11)
89 resume { i8*, i32 } %i10