<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - PhiMovesPass in register allocator broken"
href="https://bugs.freedesktop.org/show_bug.cgi?id=90887#c14">Comment # 14</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - PhiMovesPass in register allocator broken"
href="https://bugs.freedesktop.org/show_bug.cgi?id=90887">bug 90887</a>
from <span class="vcard"><a class="email" href="mailto:imirkin@alum.mit.edu" title="Ilia Mirkin <imirkin@alum.mit.edu>"> <span class="fn">Ilia Mirkin</span></a>
</span></b>
<pre>OK, so among other changes, commit e43a3a66 had the following diff:
@@ -312,23 +337,26 @@ RegAlloc::PhiMovesPass::visit(BasicBlock *bb)
Instruction *phi, *mov;
BasicBlock *pb, *pn;
+ std::stack<BasicBlock *> stack;
+
for (Graph::EdgeIterator ei = bb->cfg.incident(); !ei.end(); ei.next()) {
- pb = pn = BasicBlock::get(ei.getNode());
+ pb = BasicBlock::get(ei.getNode());
assert(pb);
-
- if (needNewElseBlock(bb, pb)) {
- pn = new BasicBlock(func);
-
- // deletes an edge, iterator is invalid after this:
- pb->cfg.detach(&bb->cfg);
- pb->cfg.attach(&pn->cfg, Graph::Edge::TREE);
- pn->cfg.attach(&bb->cfg, Graph::Edge::FORWARD); // XXX: check order !
-
- assert(pb->getExit()->op != OP_CALL);
- if (pb->getExit()->asFlow()->target.bb == bb)
- pb->getExit()->asFlow()->target.bb = pn;
- break;
- }
+ if (needNewElseBlock(bb, pb))
+ stack.push(pb);
+ }
+ while (!stack.empty()) {
+ pb = stack.top();
+ pn = new BasicBlock(func);
+ stack.pop();
+
+ pb->cfg.detach(&bb->cfg);
+ pb->cfg.attach(&pn->cfg, Graph::Edge::TREE);
+ pn->cfg.attach(&bb->cfg, Graph::Edge::FORWARD);
+
+ assert(pb->getExit()->op != OP_CALL);
+ if (pb->getExit()->asFlow()->target.bb == bb)
+ pb->getExit()->asFlow()->target.bb = pn;
}
// insert MOVs (phi->src(j) should stem from j-th in-BB)
which the patch in <span class=""><a href="attachment.cgi?id=116339" name="attach_116339" title="Candidate Fix for nv50 PhiMovesPass">attachment 116339</a> <a href="attachment.cgi?id=116339&action=edit" title="Candidate Fix for nv50 PhiMovesPass">[details]</a></span> effectively undoes. [Why was that in
there? No idea. But presumably futzing with bb's affects needNewElseBlock's
decisions.] So I'm still tending towards my solution. But I'm not particularly
happy that it has to build up and use that hash table every time even if
nothing's changed.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>