Reviewed-by: Samuel Pitoiset <samuel.pitoi...@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 <imir...@alum.mit.edu>
Cc: mesa-sta...@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()

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to