1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
5 declare i32 @__gxx_personality_v0(...)
9 define void @test1() personality ptr @__gxx_personality_v0 {
10 ; CHECK-LABEL: @test1(
12 ; CHECK-NEXT: invoke void @fn()
13 ; CHECK-NEXT: to label [[INVOKE2:%.*]] unwind label [[LPAD2:%.*]]
15 ; CHECK-NEXT: invoke void @fn()
16 ; CHECK-NEXT: to label [[COMMON_RET:%.*]] unwind label [[LPAD2]]
18 ; CHECK-NEXT: ret void
20 ; CHECK-NEXT: [[EXN2:%.*]] = landingpad { ptr, i32 }
22 ; CHECK-NEXT: call void @fn()
23 ; CHECK-NEXT: br label [[COMMON_RET]]
27 to label %invoke2 unwind label %lpad1
31 to label %invoke.cont unwind label %lpad2
37 %exn = landingpad {ptr, i32}
39 br label %shared_resume
42 %exn2 = landingpad {ptr, i32}
44 br label %shared_resume
51 ; Don't trigger if blocks aren't the same/empty
52 define void @neg1() personality ptr @__gxx_personality_v0 {
55 ; CHECK-NEXT: invoke void @fn()
56 ; CHECK-NEXT: to label [[INVOKE2:%.*]] unwind label [[LPAD1:%.*]]
58 ; CHECK-NEXT: invoke void @fn()
59 ; CHECK-NEXT: to label [[COMMON_RET:%.*]] unwind label [[LPAD2:%.*]]
61 ; CHECK-NEXT: ret void
63 ; CHECK-NEXT: [[EXN:%.*]] = landingpad { ptr, i32 }
64 ; CHECK-NEXT: filter [0 x ptr] zeroinitializer
65 ; CHECK-NEXT: call void @fn()
66 ; CHECK-NEXT: br label [[SHARED_RESUME:%.*]]
68 ; CHECK-NEXT: [[EXN2:%.*]] = landingpad { ptr, i32 }
70 ; CHECK-NEXT: br label [[SHARED_RESUME]]
71 ; CHECK: shared_resume:
72 ; CHECK-NEXT: call void @fn()
73 ; CHECK-NEXT: br label [[COMMON_RET]]
77 to label %invoke2 unwind label %lpad1
81 to label %invoke.cont unwind label %lpad2
87 %exn = landingpad {ptr, i32}
88 filter [0 x ptr] zeroinitializer
90 br label %shared_resume
93 %exn2 = landingpad {ptr, i32}
95 br label %shared_resume
102 ; Should not trigger when the landing pads are not the exact same
103 define void @neg2() personality ptr @__gxx_personality_v0 {
104 ; CHECK-LABEL: @neg2(
106 ; CHECK-NEXT: invoke void @fn()
107 ; CHECK-NEXT: to label [[INVOKE2:%.*]] unwind label [[LPAD1:%.*]]
109 ; CHECK-NEXT: invoke void @fn()
110 ; CHECK-NEXT: to label [[COMMON_RET:%.*]] unwind label [[LPAD2:%.*]]
112 ; CHECK-NEXT: ret void
114 ; CHECK-NEXT: [[EXN:%.*]] = landingpad { ptr, i32 }
115 ; CHECK-NEXT: filter [0 x ptr] zeroinitializer
116 ; CHECK-NEXT: br label [[SHARED_RESUME:%.*]]
118 ; CHECK-NEXT: [[EXN2:%.*]] = landingpad { ptr, i32 }
119 ; CHECK-NEXT: cleanup
120 ; CHECK-NEXT: br label [[SHARED_RESUME]]
121 ; CHECK: shared_resume:
122 ; CHECK-NEXT: call void @fn()
123 ; CHECK-NEXT: br label [[COMMON_RET]]
127 to label %invoke2 unwind label %lpad1
131 to label %invoke.cont unwind label %lpad2
137 %exn = landingpad {ptr, i32}
138 filter [0 x ptr] zeroinitializer
139 br label %shared_resume
142 %exn2 = landingpad {ptr, i32}
144 br label %shared_resume