Home | History | Annotate | Download | only in PruneEH
      1 ; PruneEH is less powerful than simplify-cfg in terms of cfg simplification,
      2 ; so it leaves some of the unreachable stuff hanging around.
      3 ; Checking it with CHECK-OLD.
      4 ;
      5 ; RUN: opt -prune-eh -S < %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-OLD
      6 ; RUN: opt -passes='function-attrs,function(simplify-cfg)' -S < %s | FileCheck %s  --check-prefix=CHECK --check-prefix=CHECK-NEW
      7 
      8 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
      9 target triple = "i386-pc-windows-msvc"
     10 
     11 declare void @neverthrows() nounwind
     12 
     13 define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
     14   invoke void @neverthrows()
     15           to label %try.cont unwind label %cleanuppad
     16 
     17 try.cont:
     18   ret void
     19 
     20 cleanuppad:
     21   %cp = cleanuppad within none []
     22   br label %cleanupret
     23 
     24 cleanupret:
     25   cleanupret from %cp unwind to caller
     26 }
     27 
     28 ; CHECK-LABEL: define void @test1(
     29 ; CHECK:       call void @neverthrows()
     30 ; CHECK-NEW-NEXT: ret void
     31 ; CHECK-NEW-NEXT: }
     32 ; CHECK-OLD:	  ret void
     33 
     34 ; CHECK-OLD: %[[cp:.*]] = cleanuppad within none []
     35 ; CHECK-OLD-NEXT: unreachable
     36 
     37 ; CHECK-OLD: cleanupret from %[[cp]] unwind to caller
     38 
     39 define void @test2() personality i32 (...)* @__CxxFrameHandler3 {
     40   invoke void @neverthrows()
     41           to label %try.cont unwind label %catchswitch
     42 
     43 try.cont:
     44   ret void
     45 
     46 catchswitch:
     47   %cs = catchswitch within none [label %catchpad] unwind to caller
     48 
     49 catchpad:
     50   %cp = catchpad within %cs []
     51   unreachable
     52 
     53 ret:
     54   ret void
     55 }
     56 
     57 ; CHECK-LABEL: define void @test2(
     58 ; CHECK:       call void @neverthrows()
     59 ; CHECK-NEW-NEXT: ret void
     60 ; CHECK-NEW-NEXT: }
     61 ; CHECK-OLD:      ret void
     62 
     63 ; CHECK-OLD: %[[cs:.*]] = catchswitch within none [label
     64 
     65 ; CHECK-OLD: catchpad within %[[cs]] []
     66 ; CHECK-OLD-NEXT: unreachable
     67 
     68 ; CHECK-OLD:ret void
     69 
     70 declare i32 @__CxxFrameHandler3(...)
     71