diff options
author | Christoph Bumiller <[email protected]> | 2011-02-24 17:22:15 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2011-02-24 17:35:35 +0100 |
commit | cd47f10c901d7ac48843586432c2e592ed35eed3 (patch) | |
tree | 66f60762b683a4a1a19d0c4ca21492d32a2aa08c /src/gallium/drivers/nvc0/nvc0_pc_optimize.c | |
parent | 4377657f8e204fe2c7b6af194293dd3bea63fca8 (diff) |
nvc0: preemptively insert branch at ENDIF
Might be necessary if a block sneaks in somewhere, like a common
block for moves of phi sources after a loop break.
This is harmless and normally will be removed before emission.
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_pc_optimize.c')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_pc_optimize.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_pc_optimize.c b/src/gallium/drivers/nvc0/nvc0_pc_optimize.c index 3d03400518b..8d4d0f3af60 100644 --- a/src/gallium/drivers/nvc0/nvc0_pc_optimize.c +++ b/src/gallium/drivers/nvc0/nvc0_pc_optimize.c @@ -142,9 +142,10 @@ nv_pc_pass_pre_emission(void *priv, struct nv_basic_block *b) struct nv_instruction *nvi, *next; int j; + /* find first non-empty block emitted before b */ for (j = pc->num_blocks - 1; j >= 0 && !pc->bb_list[j]->emit_size; --j); - if (j >= 0) { + for (; j >= 0; --j) { in = pc->bb_list[j]; /* check for no-op branches (BRA $PC+8) */ @@ -158,6 +159,9 @@ nv_pc_pass_pre_emission(void *priv, struct nv_basic_block *b) nvc0_insn_delete(in->exit); } b->emit_pos = in->emit_pos + in->emit_size; + + if (in->emit_size) /* no more no-op branches to b */ + break; } pc->bb_list[pc->num_blocks++] = b; |