nvc0: do not generate a backwards jump if a loop ends with BRK
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 6 Feb 2011 12:09:24 +0000 (13:09 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Wed, 9 Feb 2011 15:05:00 +0000 (16:05 +0100)
src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c

index 8c0967dfa87d60f41364a1c2cbea38420c8d9e7b..8b6cb0e7c7610dca756df9919dbe01a54d3cf240 100644 (file)
@@ -1693,9 +1693,11 @@ bld_instruction(struct bld_context *bld,
    {
       struct nv_basic_block *bb = bld->loop_bb[bld->loop_lvl - 1];
 
-      bld_flow(bld, NV_OP_BRA, NULL, bb, FALSE);
+      if (bld->out_kind != CFG_EDGE_FAKE) { /* else we already had BRK/CONT */
+         bld_flow(bld, NV_OP_BRA, NULL, bb, FALSE);
 
-      nvc0_bblock_attach(bld->pc->current_block, bb, CFG_EDGE_BACK);
+         nvc0_bblock_attach(bld->pc->current_block, bb, CFG_EDGE_BACK);
+      }
 
       bld_loop_end(bld, bb); /* replace loop-side operand of the phis */