llvm.org GIT mirror llvm / 24dcbaf
Fix PR6047 Nodes that had children outside of the post dominator tree (infinite loops) where removed from the post dominator tree. This seems to be wrong. Leave them in the tree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93633 91177308-0d34-0410-b5e6-96231b3b80d8 Tobias Grosser 10 years ago
5 changed file(s) with 206 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
261261 DT.Info[W];
262262
263263 // Step #2: Calculate the semidominators of all vertices
264 bool HasChildOutsideDFS = false;
265264
266265 // initialize the semi dominator to point to the parent node
267266 WInfo.Semi = WInfo.Parent;
268267 for (typename GraphTraits >::ChildIteratorType CI =
269268 GraphTraits >::child_begin(W),
270 E = GraphTraits >::child_end(W); CI != E; ++CI) {
269 E = GraphTraits >::child_end(W); CI != E; ++CI)
271270 if (DT.Info.count(*CI)) { // Only if this predecessor is reachable!
272271 unsigned SemiU = DT.Info[Eval(DT, *CI)].Semi;
273272 if (SemiU < WInfo.Semi)
274273 WInfo.Semi = SemiU;
275274 }
276 else {
277 // if the child has no DFS number it is not post-dominated by any exit,
278 // and so is the current block.
279 HasChildOutsideDFS = true;
280 }
281 }
282
283 // if some child has no DFS number it is not post-dominated by any exit,
284 // and so is the current block.
285 if (DT.isPostDominator() && HasChildOutsideDFS)
286 WInfo.Semi = 0;
287275
288276 DT.Info[DT.Vertex[WInfo.Semi]].Bucket.push_back(W);
289277
0 ; RUN: opt < %s -postdomtree -analyze | FileCheck %s
1 define internal void @f() {
2 entry:
3 br i1 undef, label %bb35, label %bb3.i
4
5 bb3.i:
6 br label %bb3.i
7
8 bb35.loopexit3:
9 br label %bb35
10
11 bb35:
12 ret void
13 }
14 ; CHECK: [3] %entry
0 ; RUN: opt < %s -postdomtree -analyze | FileCheck %s
1 define internal void @f() {
2 entry:
3 br i1 undef, label %a, label %bb3.i
4
5 a:
6 br i1 undef, label %bb35, label %bb3.i
7
8 bb3.i:
9 br label %bb3.i
10
11
12 bb35.loopexit3:
13 br label %bb35
14
15 bb35:
16 ret void
17 }
18 ; CHECK: [4] %entry
0 ; RUN: opt < %s -postdomtree -analyze | FileCheck %s
1 define internal void @f() {
2 entry:
3 br i1 undef, label %bb35, label %bb3.i
4
5 bb3.i:
6 br label %bb3.i
7
8 bb:
9 br label %bb35
10
11 bb.i:
12 br label %bb35
13
14 _float32_unpack.exit:
15 br label %bb35
16
17 bb.i5:
18 br label %bb35
19
20 _float32_unpack.exit8:
21 br label %bb35
22
23 bb32.preheader:
24 br label %bb35
25
26 bb3:
27 br label %bb35
28
29 bb3.split.us:
30 br label %bb35
31
32 bb.i4.us:
33 br label %bb35
34
35 bb7.i.us:
36 br label %bb35
37
38 bb.i4.us.backedge:
39 br label %bb35
40
41 bb1.i.us:
42 br label %bb35
43
44 bb6.i.us:
45 br label %bb35
46
47 bb4.i.us:
48 br label %bb35
49
50 bb8.i.us:
51 br label %bb35
52
53 bb3.i.loopexit.us:
54 br label %bb35
55
56 bb.nph21:
57 br label %bb35
58
59 bb4:
60 br label %bb35
61
62 bb5:
63 br label %bb35
64
65 bb14.preheader:
66 br label %bb35
67
68 bb.nph18:
69 br label %bb35
70
71 bb8.us.preheader:
72 br label %bb35
73
74 bb8.preheader:
75 br label %bb35
76
77 bb8.us:
78 br label %bb35
79
80 bb8:
81 br label %bb35
82
83 bb15.loopexit:
84 br label %bb35
85
86 bb15.loopexit2:
87 br label %bb35
88
89 bb15:
90 br label %bb35
91
92 bb16:
93 br label %bb35
94
95 bb17.loopexit.split:
96 br label %bb35
97
98 bb.nph14:
99 br label %bb35
100
101 bb19:
102 br label %bb35
103
104 bb20:
105 br label %bb35
106
107 bb29.preheader:
108 br label %bb35
109
110 bb.nph:
111 br label %bb35
112
113 bb23.us.preheader:
114 br label %bb35
115
116 bb23.preheader:
117 br label %bb35
118
119 bb23.us:
120 br label %bb35
121
122 bb23:
123 br label %bb35
124
125 bb30.loopexit:
126 br label %bb35
127
128 bb30.loopexit1:
129 br label %bb35
130
131 bb30:
132 br label %bb35
133
134 bb31:
135 br label %bb35
136
137 bb35.loopexit:
138 br label %bb35
139
140 bb35.loopexit3:
141 br label %bb35
142
143 bb35:
144 ret void
145 }
146 ; CHECK: [3] %entry
0 ; RUN: opt < %s -postdomtree -analyze | FileCheck %s
1 define internal void @f() {
2 entry:
3 br i1 1, label %a, label %b
4
5 a:
6 br label %c
7
8 b:
9 br label %c
10
11 c:
12 br i1 undef, label %bb35, label %bb3.i
13
14 bb3.i:
15 br label %bb3.i
16
17 bb35.loopexit3:
18 br label %bb35
19
20 bb35:
21 ret void
22 }
23 ; CHECK: [4] %entry