Mesa (master): glsl: Rename loop_unroll_count::fail to "nested_loop."

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Apr 12 00:41:11 UTC 2014


Module: Mesa
Branch: master
Commit: 2231db559819d62303660dbe551cbcd6c9610793
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2231db559819d62303660dbe551cbcd6c9610793

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Apr  8 15:33:27 2014 -0700

glsl: Rename loop_unroll_count::fail to "nested_loop."

The "fail" flag is set if loop_unroll_count encounters a nested loop;
calling the flag "nested_loop" is a bit clearer.

The original reasoning was that count is inaccurate (too small) if there
are nested loops, as we don't do any sort of analysis on the inner loop.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/glsl/loop_unroll.cpp |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp
index 11680b3..1ce4d58 100644
--- a/src/glsl/loop_unroll.cpp
+++ b/src/glsl/loop_unroll.cpp
@@ -63,12 +63,13 @@ is_break(ir_instruction *ir)
 class loop_unroll_count : public ir_hierarchical_visitor {
 public:
    int nodes;
-   bool fail;
+   /* If there are nested loops, the node count will be inaccurate. */
+   bool nested_loop;
 
    loop_unroll_count(exec_list *list)
    {
       nodes = 0;
-      fail = false;
+      nested_loop = false;
 
       run(list);
    }
@@ -87,7 +88,7 @@ public:
 
    virtual ir_visitor_status visit_enter(ir_loop *)
    {
-      fail = true;
+      nested_loop = true;
       return visit_continue;
    }
 };
@@ -258,7 +259,7 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
     */
    loop_unroll_count count(&ir->body_instructions);
 
-   if (count.fail || count.nodes * iterations > max_iterations * 5)
+   if (count.nested_loop || count.nodes * iterations > max_iterations * 5)
       return visit_continue;
 
    /* Note: the limiting terminator contributes 1 to ls->num_loop_jumps.




More information about the mesa-commit mailing list