[Mesa-dev] [PATCH] glsl: Fix a copy_prop_elements crash when a kill kills for two reasons.

Eric Anholt eric at anholt.net
Fri Apr 8 11:01:42 PDT 2011


Fixes glsl-copy-propagation-loop-2 when this optimization pass is
re-enabled.

Reported-by: David Lamparter <equinox at diac24.net>
---

Thanks for testing!  Just from looking at the line of the crash, I
think I caught the bug and added a testcase.  Can you check if this
resolves your issues?

 src/glsl/opt_copy_propagation_elements.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/glsl/opt_copy_propagation_elements.cpp b/src/glsl/opt_copy_propagation_elements.cpp
index 1ffbd4d..a91e624 100644
--- a/src/glsl/opt_copy_propagation_elements.cpp
+++ b/src/glsl/opt_copy_propagation_elements.cpp
@@ -390,8 +390,10 @@ ir_copy_propagation_elements_visitor::kill(kill_entry *k)
 
       if (entry->lhs == k->var) {
 	 entry->write_mask = entry->write_mask & ~k->write_mask;
-	 if (entry->write_mask == 0)
+	 if (entry->write_mask == 0) {
 	    entry->remove();
+	    continue;
+	 }
       }
       if (entry->rhs == k->var) {
 	 entry->remove();
-- 
1.7.4.1



More information about the mesa-dev mailing list