[IR] Reformulate LLVM's EH funclet IR
[oota-llvm.git] / test / Transforms / LoopStrengthReduce / funclet.ll
index 03799ddfdb5c15be1f7f69c8f8cdf5271bf49539..a2da3208a38f5eca040b0d459e84293129d10e9b 100644 (file)
@@ -20,19 +20,17 @@ throw:                                            ; preds = %throw, %entry
 
 pad:                                              ; preds = %throw
   %phi2 = phi i8* [ %tmp96, %throw ]
-  terminatepad [] unwind label %blah
+  terminatepad within none [] unwind label %blah
 
 blah:
-  catchpad [] to label %unreachable unwind label %blah3
+  %cs = catchswitch within none [label %unreachable] unwind label %blah2
 
 unreachable:
+  catchpad within %cs []
   unreachable
 
-blah3:
-  catchendpad unwind label %blah2
-
 blah2:
-  %cleanuppadi4.i.i.i = cleanuppad []
+  %cleanuppadi4.i.i.i = cleanuppad within none []
   br label %loop_body
 
 loop_body:                                        ; preds = %iter, %pad
@@ -45,11 +43,11 @@ iter:                                             ; preds = %loop_body
   br i1 undef, label %unwind_out, label %loop_body
 
 unwind_out:                                       ; preds = %iter, %loop_body
-  cleanupret %cleanuppadi4.i.i.i unwind to caller
+  cleanupret from %cleanuppadi4.i.i.i unwind to caller
 }
 
 ; CHECK-LABEL: define void @f(
-; CHECK: cleanuppad []
+; CHECK: cleanuppad within none []
 ; CHECK-NEXT: ptrtoint i8* %phi2 to i32
 
 define void @g() personality i32 (...)* @_except_handler3 {
@@ -63,20 +61,18 @@ throw:                                            ; preds = %throw, %entry
 
 pad:
   %phi2 = phi i8* [ %tmp96, %throw ]
-  catchpad [] to label %unreachable unwind label %blah
+  %cs = catchswitch within none [label %unreachable, label %blah] unwind to caller
 
 unreachable:
+  catchpad within %cs []
   unreachable
 
 blah:
-  %catchpad = catchpad [] to label %loop_body unwind label %blah3
-
-
-blah3:
-  catchendpad unwind to caller ;label %blah2
+  %catchpad = catchpad within %cs []
+  br label %loop_body
 
 unwind_out:
-  catchret %catchpad to label %leave
+  catchret from %catchpad to label %leave
 
 leave:
   ret void
@@ -93,10 +89,7 @@ iter:                                             ; preds = %loop_body
 
 ; CHECK-LABEL: define void @g(
 ; CHECK: blah:
-; CHECK-NEXT: catchpad []
-; CHECK-NEXT: to label %loop_body.preheader
-
-; CHECK: loop_body.preheader:
+; CHECK-NEXT: catchpad within %cs []
 ; CHECK-NEXT: ptrtoint i8* %phi2 to i32
 
 
@@ -110,29 +103,25 @@ throw:                                            ; preds = %throw, %entry
           to label %throw unwind label %pad
 
 pad:
-  catchpad [] to label %unreachable unwind label %blug
+  %cs = catchswitch within none [label %unreachable, label %blug] unwind to caller
 
 unreachable:
+  catchpad within %cs []
   unreachable
 
 blug:
   %phi2 = phi i8* [ %tmp96, %pad ]
-  %catchpad = catchpad [] to label %blah2 unwind label %blah3
-
-blah2:
+  %catchpad = catchpad within %cs []
   br label %loop_body
 
-blah3:
-  catchendpad unwind to caller ;label %blah2
-
 unwind_out:
-  catchret %catchpad to label %leave
+  catchret from %catchpad to label %leave
 
 leave:
   ret void
 
 loop_body:                                        ; preds = %iter, %pad
-  %tmp99 = phi i8* [ %tmp101, %iter ], [ %phi2, %blah2 ]
+  %tmp99 = phi i8* [ %tmp101, %iter ], [ %phi2, %blug ]
   %tmp100 = icmp eq i8* %tmp99, undef
   br i1 %tmp100, label %unwind_out, label %iter
 
@@ -143,10 +132,7 @@ iter:                                             ; preds = %loop_body
 
 ; CHECK-LABEL: define void @h(
 ; CHECK: blug:
-; CHECK: catchpad []
-; CHECK-NEXT: to label %blah2
-
-; CHECK: blah2:
+; CHECK: catchpad within %cs []
 ; CHECK-NEXT: ptrtoint i8* %phi2 to i32
 
 define void @i() personality i32 (...)* @_except_handler3 {
@@ -160,16 +146,14 @@ throw:                                            ; preds = %throw, %entry
 
 catchpad:                                              ; preds = %throw
   %phi2 = phi i8* [ %tmp96, %throw ]
-  catchpad [] to label %cp_body unwind label %catchendpad
+  %cs = catchswitch within none [label %cp_body] unwind label %cleanuppad
 
 cp_body:
+  catchpad within %cs []
   br label %loop_head
 
-catchendpad:
-  catchendpad unwind label %cleanuppad
-
 cleanuppad:
-  cleanuppad []
+  cleanuppad within none []
   br label %loop_head
 
 loop_head:
@@ -205,39 +189,31 @@ for.inc:                                          ; preds = %for.cond
   br label %for.cond
 
 catch.dispatch:                                   ; preds = %for.cond
-  %0 = catchpad [i8* null, i32 64, i8* null]
-          to label %catch unwind label %catchendblock
-
-catchendblock:                                    ; preds = %catch.dispatch
-  catchendpad unwind label %catch.dispatch.2
+  %cs = catchswitch within none [label %catch] unwind label %catch.dispatch.2
 
 catch:                                            ; preds = %catch.dispatch
-  catchret %0 to label %try.cont
+  %0 = catchpad within %cs [i8* null, i32 64, i8* null]
+  catchret from %0 to label %try.cont
 
 try.cont:                                         ; preds = %catch
   invoke void @external(i32* %c)
           to label %try.cont.7 unwind label %catch.dispatch.2
 
 catch.dispatch.2:                                 ; preds = %try.cont, %catchendblock
-  %e.0 = phi i32* [ %c, %try.cont ], [ %b, %catchendblock ]
-  %1 = catchpad [i8* null, i32 64, i8* null]
-          to label %catch.4 unwind label %catchendblock.3
+  %e.0 = phi i32* [ %c, %try.cont ], [ %b, %catch.dispatch ]
+  %cs2 = catchswitch within none [label %catch.4] unwind to caller
 
 catch.4:                                          ; preds = %catch.dispatch.2
+  catchpad within %cs2 [i8* null, i32 64, i8* null]
   unreachable
 
 try.cont.7:                                       ; preds = %try.cont
   ret void
-
-catchendblock.3:                                  ; preds = %catch.dispatch.2
-  catchendpad unwind to caller
 }
 
 ; CHECK-LABEL: define void @test1(
 ; CHECK: for.cond:
 ; CHECK:   %d.0 = phi i32* [ %b, %entry ], [ %incdec.ptr, %for.inc ]
 
-; CHECK: catchendpad unwind label %catch.dispatch.2
-
 ; CHECK: catch.dispatch.2:
-; CHECK: %e.0 = phi i32* [ %c, %try.cont ], [ %b, %catchendblock ]
+; CHECK: %e.0 = phi i32* [ %c, %try.cont ], [ %b, %catch.dispatch ]