Mesa (7.9): glsl: Consider the "else" branch when looking for loop breaks.

Ian Romanick idr at kemper.freedesktop.org
Mon Dec 27 21:33:19 UTC 2010


Module: Mesa
Branch: 7.9
Commit: 4f2f3440d07d1048dbef92bf3bf218139cb7d667
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f2f3440d07d1048dbef92bf3bf218139cb7d667

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Dec  1 15:33:56 2010 -0800

glsl: Consider the "else" branch when looking for loop breaks.

Found this bug by code inspection.  Based off the comments just before
this code, the intent is to find whether the break exists in the "then"
branch or the "else" branch.  However, the code actually looked at the
last instruction in the "then" branch twice.
(cherry picked from commit 13c45c590b69341487acf21f339bf1e502eedee6)

---

 src/glsl/loop_unroll.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp
index 9979106..48a7761 100644
--- a/src/glsl/loop_unroll.cpp
+++ b/src/glsl/loop_unroll.cpp
@@ -104,7 +104,7 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
 	 if (is_break(last)) {
 	    continue_from_then_branch = false;
 	 } else {
-	    last = (ir_instruction *) last_if->then_instructions.get_tail();
+	    last = (ir_instruction *) last_if->else_instructions.get_tail();
 
 	    if (is_break(last))
 	       continue_from_then_branch = true;




More information about the mesa-commit mailing list