[Mesa-dev] [PATCH] nv50/ir: make sure cfg iterator always hits all blocks
Samuel Pitoiset
samuel.pitoiset at gmail.com
Mon Aug 22 19:14:18 UTC 2016
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
On 08/19/2016 06:45 AM, Ilia Mirkin wrote:
> In some very specially-crafted cases, we could attempt to visit a node
> that has already been visited, and then run out of bb's to visit, while
> there were still cross blocks on the list. Make sure that those get
> moved over in that case.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96274
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> Cc: mesa-stable at lists.freedesktop.org
> ---
> src/gallium/drivers/nouveau/codegen/nv50_ir_graph.cpp | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.cpp
> index 23414d5..b1076cf 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.cpp
> @@ -280,21 +280,24 @@ public:
> virtual void next() { if (pos < count) ++pos; }
> virtual void reset() { pos = 0; }
>
> private:
> void search(Graph::Node *node, const int sequence)
> {
> Stack bb, cross;
>
> bb.push(node);
>
> - while (bb.getSize()) {
> + while (bb.getSize() || cross.getSize()) {
> + if (bb.getSize() == 0)
> + cross.moveTo(bb);
> +
> node = reinterpret_cast<Graph::Node *>(bb.pop().u.p);
> assert(node);
> if (!node->visit(sequence))
> continue;
> node->tag = 0;
>
> for (Graph::EdgeIterator ei = node->outgoing(); !ei.end(); ei.next()) {
> switch (ei.getType()) {
> case Graph::Edge::TREE:
> case Graph::Edge::FORWARD:
> @@ -307,23 +310,20 @@ private:
> case Graph::Edge::CROSS:
> if (++(ei.getNode()->tag) == 1)
> cross.push(ei.getNode());
> break;
> default:
> assert(!"unknown edge kind in CFG");
> break;
> }
> }
> nodes[count++] = node;
> -
> - if (bb.getSize() == 0)
> - cross.moveTo(bb);
> }
> }
>
> private:
> Graph::Node **nodes;
> int count;
> int pos;
> };
>
> IteratorRef Graph::iteratorCFG()
>
More information about the mesa-dev
mailing list