Home | History | Annotate | Download | only in SimplifyCFG
      1 ; RUN: opt < %s -simplifycfg -S | FileCheck %s
      2 
      3 declare void @bar()
      4 
      5 ; This testcase checks to see if the simplifycfg pass is converting invoke
      6 ; instructions to call instructions if the handler just rethrows the exception.
      7 define i32 @test1() {
      8 ; CHECK: @test1
      9 ; CHECK-NEXT: call void @bar()
     10 ; CHECK-NEXT: ret i32 0
     11         invoke void @bar( )
     12                         to label %1 unwind label %Rethrow
     13         ret i32 0
     14 Rethrow:
     15         unwind
     16 }
     17 
     18 
     19 ; Verify that simplifycfg isn't duplicating 'unwind' instructions.  Doing this
     20 ; is bad because it discourages commoning.
     21 define i32 @test2(i1 %c) {
     22 ; CHECK: @test2
     23 ; CHECK: T:
     24 ; CHECK-NEXT: call void @bar()
     25 ; CHECK-NEXT: br label %F
     26   br i1 %c, label %T, label %F
     27 T:
     28   call void @bar()
     29   br label %F
     30 F:
     31   unwind
     32 }
     33