summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_from_ssa.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-10-29 16:25:51 -0700
committerJason Ekstrand <[email protected]>2015-01-15 07:19:00 -0800
commitd7e482d32cf0188a1ed49e76f008837be5cfd720 (patch)
tree930b26ec87e89af39d2894f81758a07e20dd6e41 /src/glsl/nir/nir_from_ssa.c
parentdfdf0c46732dd20b5796778dc446fb0a34649f1e (diff)
nir: Add a function to detect if a block is immediately followed by an if
Since we don't actually have an "if" instruction, this is a very common pattern when iterating over instructions. This adds a helper function for it to make things a little less painful. Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_from_ssa.c')
-rw-r--r--src/glsl/nir/nir_from_ssa.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/glsl/nir/nir_from_ssa.c b/src/glsl/nir/nir_from_ssa.c
index abfee3577a0..c88583af971 100644
--- a/src/glsl/nir/nir_from_ssa.c
+++ b/src/glsl/nir/nir_from_ssa.c
@@ -107,12 +107,9 @@ convert_from_ssa_block(nir_block *block, void *void_state)
}
}
- if (block->cf_node.node.next != NULL && /* check that we aren't the end node */
- !nir_cf_node_is_last(&block->cf_node) &&
- nir_cf_node_next(&block->cf_node)->type == nir_cf_node_if) {
- nir_if *if_stmt = nir_cf_node_as_if(nir_cf_node_next(&block->cf_node));
- rewrite_ssa_src(&if_stmt->condition, state);
- }
+ nir_if *following_if = nir_block_following_if(block);
+ if (following_if)
+ rewrite_ssa_src(&following_if->condition, state);
return true;
}