@@ -109,28 +109,27 @@ pub fn dominators<G: ControlFlowGraph>(graph: G) -> Dominators<G::Node> {
109
109
// they have been placed in the bucket.
110
110
//
111
111
// We compute a partial set of immediate dominators here.
112
- let z = parent[ w] ;
113
- for & v in bucket[ z] . iter ( ) {
112
+ for & v in bucket[ w] . iter ( ) {
114
113
// This uses the result of Lemma 5 from section 2 from the original
115
114
// 1979 paper, to compute either the immediate or relative dominator
116
115
// for a given vertex v.
117
116
//
118
117
// eval returns a vertex y, for which semi[y] is minimum among
119
- // vertices semi[v] +> y *> v. Note that semi[v] = z as we're in the
120
- // z bucket.
118
+ // vertices semi[v] +> y *> v. Note that semi[v] = w as we're in the
119
+ // w bucket.
121
120
//
122
121
// Given such a vertex y, semi[y] <= semi[v] and idom[y] = idom[v].
123
122
// If semi[y] = semi[v], though, idom[v] = semi[v].
124
123
//
125
124
// Using this, we can either set idom[v] to be:
126
- // * semi[v] (i.e. z ), if semi[y] is z
125
+ // * semi[v] (i.e. w ), if semi[y] is w
127
126
// * idom[y], otherwise
128
127
//
129
128
// We don't directly set to idom[y] though as it's not necessarily
130
129
// known yet. The second preorder traversal will cleanup by updating
131
130
// the idom for any that were missed in this pass.
132
131
let y = eval ( & mut parent, lastlinked, & semi, & mut label, v) ;
133
- idom[ v] = if semi[ y] < z { y } else { z } ;
132
+ idom[ v] = if semi[ y] < w { y } else { w } ;
134
133
}
135
134
136
135
// This loop computes the semi[w] for w.
@@ -213,10 +212,11 @@ pub fn dominators<G: ControlFlowGraph>(graph: G) -> Dominators<G::Node> {
213
212
// If we don't yet know the idom directly, then push this vertex into
214
213
// our semidominator's bucket, where it will get processed at a later
215
214
// stage to compute its immediate dominator.
216
- if parent[ w] != semi[ w] {
215
+ let z = parent[ w] ;
216
+ if z != semi[ w] {
217
217
bucket[ semi[ w] ] . push ( w) ;
218
218
} else {
219
- idom[ w] = parent [ w ] ;
219
+ idom[ w] = z ;
220
220
}
221
221
222
222
// Optimization: We share the parent array between processed and not
0 commit comments