Mesa (glsl2): glsl2: Check when inlining a bare function call that it actually is.

Eric Anholt anholt at kemper.freedesktop.org
Mon Jul 12 20:34:57 UTC 2010


Module: Mesa
Branch: glsl2
Commit: d2afc874452a84965ee71c96f80e1d124c211ff4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d2afc874452a84965ee71c96f80e1d124c211ff4

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Jul 12 10:13:20 2010 -0700

glsl2: Check when inlining a bare function call that it actually is.

It would be easy to miss an entry either of the two visitors involved
that would result in trying to ir->remove() the call to remove it from
the instruction stream when really it's part of an expression tree
that wasn't flattened.

---

 src/glsl/ir_function_inlining.cpp |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp
index 6fe1264..8c545aa 100644
--- a/src/glsl/ir_function_inlining.cpp
+++ b/src/glsl/ir_function_inlining.cpp
@@ -233,6 +233,12 @@ ir_visitor_status
 ir_function_inlining_visitor::visit_enter(ir_call *ir)
 {
    if (can_inline(ir)) {
+      /* If the call was part of some tree, then it should have been
+       * flattened out or we shouldn't have seen it because of a
+       * visit_continue_with_parent in this visitor.
+       */
+      assert(ir == base_ir);
+
       (void) ir->generate_inline(ir);
       ir->remove();
       this->progress = true;




More information about the mesa-commit mailing list