summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/r600/sb/sb_bc_finalize.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
index 099b295f18f..d3fab800204 100644
--- a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
+++ b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
@@ -208,8 +208,25 @@ void bc_finalizer::finalize_if(region_node* r) {
r->push_front(if_jump);
r->push_back(if_pop);
+ /* the depart/repeat 1 is actually part of the "else" code.
+ * if it's a depart for an outer loop region it will want to
+ * insert a LOOP_BREAK or LOOP_CONTINUE in here, so we need
+ * to emit the else clause.
+ */
bool has_else = n_if->next;
+ if (repdep1->is_depart()) {
+ depart_node *dep1 = static_cast<depart_node*>(repdep1);
+ if (dep1->target != r && dep1->target->is_loop())
+ has_else = true;
+ }
+
+ if (repdep1->is_repeat()) {
+ repeat_node *rep1 = static_cast<repeat_node*>(repdep1);
+ if (rep1->target != r && rep1->target->is_loop())
+ has_else = true;
+ }
+
if (has_else) {
cf_node *nelse = sh.create_cf(CF_OP_ELSE);
n_if->insert_after(nelse);