Mark Seaborn | 277fbe1 | 2014-03-20 14:12:47 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -lowerinvoke -S | FileCheck %s |
Michael Kuperstein | 31b8399 | 2016-08-12 17:28:27 +0000 | [diff] [blame] | 2 | ; RUN: opt < %s -passes='lowerinvoke' -S | FileCheck %s |
Mark Seaborn | 277fbe1 | 2014-03-20 14:12:47 +0000 | [diff] [blame] | 3 | |
| 4 | declare i32 @external_func(i64 %arg) |
| 5 | |
David Majnemer | 7fddecc | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 6 | define i32 @invoke_test(i64 %arg) personality i8* null { |
Mark Seaborn | 277fbe1 | 2014-03-20 14:12:47 +0000 | [diff] [blame] | 7 | entry: |
| 8 | %result = invoke fastcc i32 @external_func(i64 inreg %arg) |
| 9 | to label %cont unwind label %lpad |
| 10 | cont: |
| 11 | ret i32 %result |
| 12 | lpad: |
| 13 | %phi = phi i32 [ 99, %entry ] |
David Majnemer | 7fddecc | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 14 | %lp = landingpad { i8*, i32 } cleanup |
Mark Seaborn | 277fbe1 | 2014-03-20 14:12:47 +0000 | [diff] [blame] | 15 | ret i32 %phi |
| 16 | } |
| 17 | |
| 18 | ; The "invoke" should be converted to a "call". |
| 19 | ; CHECK-LABEL: define i32 @invoke_test |
| 20 | ; CHECK: %result = call fastcc i32 @external_func(i64 inreg %arg) |
| 21 | ; CHECK-NEXT: br label %cont |
| 22 | |
| 23 | ; Note that this pass does not remove dead landingpad blocks. |
| 24 | ; CHECK: lpad: |
| 25 | ; CHECK-NOT: phi |
| 26 | ; CHECK: landingpad |