1; RUN: opt -S -simplifycfg < %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
7define i32 @div(i32 %n, i32 %d) nounwind {
8entry:
9  %div = sdiv i32 %n, %d
10  ret i32 %div
11}
12
13define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
14entry:
15  %call = invoke i32 @div(i32 10, i32 0)
16          to label %__try.cont unwind label %lpad
17
18lpad:
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
31declare i32 @__C_specific_handler(...)
32