blob: c380c6ce2ce91b75946916be5a56d9451ffd4389 [file] [log] [blame]
Reid Kleckner96d01132015-02-11 01:23:16 +00001; 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
David Majnemer7fddecc2015-06-17 20:52:32 +000013define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
Reid Kleckner96d01132015-02-11 01:23:16 +000014entry:
15 %call = invoke i32 @div(i32 10, i32 0)
16 to label %__try.cont unwind label %lpad
17
18lpad:
David Majnemer7fddecc2015-06-17 20:52:32 +000019 %0 = landingpad { i8*, i32 }
Reid Kleckner96d01132015-02-11 01:23:16 +000020 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(...)