Pete Cooper | 4d8d2ec | 2015-04-30 18:58:23 +0000 | [diff] [blame] | 1 | ; RUN: llc %s -o - -verify-machineinstrs | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 4 | target triple = "x86_64-unknown-unknown" |
| 5 | |
| 6 | ; The machine level BranchFolding pass will try to remove the 'unreachable' block |
| 7 | ; and rewrite 'entry' to jump to the block 'unreachable' falls through to. |
| 8 | ; That will be a landing pad and result in 'entry' jumping to 2 landing pads. |
| 9 | ; This tests that we don't do this change when the fallthrough is itself a landing |
| 10 | ; pad. |
| 11 | |
| 12 | declare i32 @__gxx_personality_v0(...) |
| 13 | declare void @foo() |
| 14 | |
| 15 | ; Function Attrs: noreturn |
| 16 | declare void @_throw() |
| 17 | |
| 18 | ; CHECK-LABEL: @main |
| 19 | ; CHECK: %unreachable |
| 20 | |
David Majnemer | 7fddecc | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 21 | define i32 @main(i8* %cleanup) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
Pete Cooper | 4d8d2ec | 2015-04-30 18:58:23 +0000 | [diff] [blame] | 22 | entry: |
| 23 | invoke void @_throw() #0 |
| 24 | to label %unreachable unwind label %catch.dispatch9 |
| 25 | |
| 26 | catch.dispatch9: ; preds = %entry |
David Majnemer | 7fddecc | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 27 | %tmp13 = landingpad { i8*, i32 } |
Pete Cooper | 4d8d2ec | 2015-04-30 18:58:23 +0000 | [diff] [blame] | 28 | cleanup |
| 29 | catch i8* null |
| 30 | invoke void @_throw() #0 |
| 31 | to label %unreachable unwind label %lpad31 |
| 32 | |
| 33 | lpad31: ; preds = %catch.dispatch9 |
David Majnemer | 7fddecc | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 34 | %tmp20 = landingpad { i8*, i32 } |
Pete Cooper | 4d8d2ec | 2015-04-30 18:58:23 +0000 | [diff] [blame] | 35 | cleanup |
| 36 | catch i8* null |
| 37 | call void @foo() |
| 38 | unreachable |
| 39 | |
| 40 | unreachable: ; preds = %catch.dispatch9, %entry |
| 41 | unreachable |
| 42 | } |
| 43 | |
| 44 | attributes #0 = { noreturn } |
| 45 | |