Home | History | Annotate | Download | only in PruneEH
      1 ; RUN: opt -S -prune-eh < %s | FileCheck %s
      2 
      3 ; Don't remove invokes of nounwind functions if the personality handles async
      4 ; exceptions. The @div function in this test can fault, even though it can't
      5 ; throw a synchronous exception.
      6 
      7 define i32 @div(i32 %n, i32 %d) nounwind {
      8 entry:
      9   %div = sdiv i32 %n, %d
     10   ret i32 %div
     11 }
     12 
     13 define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
     14 entry:
     15   %call = invoke i32 @div(i32 10, i32 0)
     16           to label %__try.cont unwind label %lpad
     17 
     18 lpad:
     19   %0 = landingpad { i8*, i32 }
     20           catch i8* null
     21   br label %__try.cont
     22 
     23 __try.cont:
     24   %retval.0 = phi i32 [ %call, %entry ], [ 0, %lpad ]
     25   ret i32 %retval.0
     26 }
     27 
     28 ; CHECK-LABEL: define i32 @main()
     29 ; CHECK: invoke i32 @div(i32 10, i32 0)
     30 
     31 declare i32 @__C_specific_handler(...)
     32