Reid Kleckner | 690248b | 2015-02-11 01:23:16 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -O2 < %s | FileCheck %s |
| 2 | |
| 3 | ; Feature test that verifies that all optimizations leave asynch personality |
| 4 | ; invokes of nounwind functions alone. |
| 5 | ; The @div function in this test can fault, even though it can't |
| 6 | ; throw a synchronous exception. |
| 7 | |
| 8 | define i32 @div(i32 %n, i32 %d) nounwind noinline { |
| 9 | entry: |
| 10 | %div = sdiv i32 %n, %d |
| 11 | ret i32 %div |
| 12 | } |
| 13 | |
David Majnemer | cc714e2 | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 14 | define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) { |
Reid Kleckner | 690248b | 2015-02-11 01:23:16 +0000 | [diff] [blame] | 15 | entry: |
| 16 | %call = invoke i32 @div(i32 10, i32 0) |
| 17 | to label %__try.cont unwind label %lpad |
| 18 | |
| 19 | lpad: |
David Majnemer | cc714e2 | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 20 | %0 = landingpad { i8*, i32 } |
Reid Kleckner | 690248b | 2015-02-11 01:23:16 +0000 | [diff] [blame] | 21 | catch i8* null |
| 22 | br label %__try.cont |
| 23 | |
| 24 | __try.cont: |
| 25 | %retval.0 = phi i32 [ %call, %entry ], [ 0, %lpad ] |
| 26 | ret i32 %retval.0 |
| 27 | } |
| 28 | |
| 29 | ; CHECK-LABEL: define i32 @main() |
| 30 | ; CHECK: invoke i32 @div(i32 10, i32 0) |
| 31 | |
| 32 | declare i32 @__C_specific_handler(...) |