xref: /llvm-project/llvm/test/CodeGen/X86/branchfolding-landingpads.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc %s -o - -verify-machineinstrs | FileCheck %s
2
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4target 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
12declare i32 @__gxx_personality_v0(...)
13declare void @foo()
14
15; Function Attrs: noreturn
16declare void @_throw()
17
18; CHECK-LABEL: @main
19; CHECK: %unreachable
20
21define i32 @main(ptr %cleanup) personality ptr @__gxx_personality_v0 {
22entry:
23  invoke void @_throw() #0
24          to label %unreachable unwind label %catch.dispatch9
25
26catch.dispatch9:                                  ; preds = %entry
27  %tmp13 = landingpad { ptr, i32 }
28          cleanup
29          catch ptr null
30  invoke void @_throw() #0
31          to label %unreachable unwind label %lpad31
32
33lpad31:                                           ; preds = %catch.dispatch9
34  %tmp20 = landingpad { ptr, i32 }
35          cleanup
36          catch ptr null
37  call void @foo()
38  unreachable
39
40unreachable:                                      ; preds = %catch.dispatch9, %entry
41  unreachable
42}
43
44attributes #0 = { noreturn }
45
46