irreducible-cfg-exceptions.ll
3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-block-placement -wasm-disable-explicit-locals -wasm-keep-registers -enable-emscripten-cxx-exceptions | FileCheck %s
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
declare i32 @__gxx_personality_v0(...)
; Check an interesting case of complex control flow due to exceptions CFG rewriting.
; There should *not* be any irreducible control flow here.
; CHECK-LABEL: crashy:
; CHECK-NOT: br_table
define void @crashy() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
entry:
invoke void undef()
to label %invoke.cont unwind label %lpad
invoke.cont: ; preds = %entry
invoke void undef()
to label %invoke.cont4 unwind label %lpad3
invoke.cont4: ; preds = %invoke.cont
%call.i82 = invoke i8* undef()
to label %invoke.cont6 unwind label %lpad3
invoke.cont6: ; preds = %invoke.cont4
invoke void undef()
to label %invoke.cont13 unwind label %lpad12
invoke.cont13: ; preds = %invoke.cont6
br label %for.cond
for.cond: ; preds = %for.cond.backedge, %invoke.cont13
br i1 undef, label %exit2, label %land.lhs
land.lhs: ; preds = %for.cond
%call.i.i.i.i92 = invoke i32 undef()
to label %exit1 unwind label %lpad16.loopexit
exit1: ; preds = %land.lhs
br label %exit2
exit2: ; preds = %exit1, %for.cond
%call.i.i12.i.i93 = invoke i32 undef()
to label %exit3 unwind label %lpad16.loopexit
exit3: ; preds = %exit2
invoke void undef()
to label %invoke.cont23 unwind label %lpad22
invoke.cont23: ; preds = %exit3
invoke void undef()
to label %invoke.cont25 unwind label %lpad22
invoke.cont25: ; preds = %invoke.cont23
%call.i.i137 = invoke i32 undef()
to label %invoke.cont29 unwind label %lpad16.loopexit
lpad: ; preds = %entry
%0 = landingpad { i8*, i32 }
cleanup
unreachable
lpad3: ; preds = %invoke.cont4, %invoke.cont
%1 = landingpad { i8*, i32 }
cleanup
unreachable
lpad12: ; preds = %invoke.cont6
%2 = landingpad { i8*, i32 }
cleanup
resume { i8*, i32 } undef
lpad16.loopexit: ; preds = %if.then, %invoke.cont29, %invoke.cont25, %exit2, %land.lhs
%lpad.loopexit = landingpad { i8*, i32 }
cleanup
unreachable
lpad22: ; preds = %invoke.cont23, %exit3
%3 = landingpad { i8*, i32 }
cleanup
unreachable
invoke.cont29: ; preds = %invoke.cont25
invoke void undef()
to label %invoke.cont33 unwind label %lpad16.loopexit
invoke.cont33: ; preds = %invoke.cont29
br label %for.inc
for.inc: ; preds = %invoke.cont33
%cmp.i.i141 = icmp eq i8* undef, undef
br i1 %cmp.i.i141, label %if.then, label %if.end.i.i146
if.then: ; preds = %for.inc
%call.i.i148 = invoke i32 undef()
to label %for.cond.backedge unwind label %lpad16.loopexit
for.cond.backedge: ; preds = %if.end.i.i146, %if.then
br label %for.cond
if.end.i.i146: ; preds = %for.inc
call void undef()
br label %for.cond.backedge
}