Home | History | Annotate | Download | only in Inline
      1 ; Test that if an invoked function is inlined, and if that function cannot
      2 ; throw, that the dead handler is now unreachable.
      3 
      4 ; RUN: opt < %s -inline -simplifycfg -S | \
      5 ; RUN:   not grep UnreachableExceptionHandler
      6 
      7 declare void @might_throw()
      8 
      9 define internal i32 @callee() {
     10         invoke void @might_throw( )
     11                         to label %cont unwind label %exc
     12 
     13 cont:           ; preds = %0
     14         ret i32 0
     15 
     16 exc:            ; preds = %0
     17         ret i32 1
     18 }
     19 
     20 ; caller returns true if might_throw throws an exception... callee cannot throw.
     21 define i32 @caller() {
     22         %X = invoke i32 @callee( )
     23                         to label %cont unwind label %UnreachableExceptionHandler                ; <i32> [#uses=1]
     24 
     25 cont:           ; preds = %0
     26         ret i32 %X
     27 
     28 UnreachableExceptionHandler:            ; preds = %0
     29         ret i32 -1
     30 }
     31