summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-07-20 10:37:43 -0700
committerJason Ekstrand <[email protected]>2016-12-05 15:40:09 -0800
commit257aa5a1c4a2284ffd43759daa405fc135a40094 (patch)
treeb61f02c5140cb80a7444353c4a11ebbba97cdd00 /src
parent507626304c047dacb959feaf94ff520a4e9f6c60 (diff)
nir/lower_returns: Stop using constant initializers
Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_lower_returns.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_lower_returns.c b/src/compiler/nir/nir_lower_returns.c
index 8dbea6e7179..cf49d5b09e3 100644
--- a/src/compiler/nir/nir_lower_returns.c
+++ b/src/compiler/nir/nir_lower_returns.c
@@ -147,17 +147,18 @@ lower_returns_in_block(nir_block *block, struct lower_returns_state *state)
nir_instr_remove(&jump->instr);
nir_builder *b = &state->builder;
- b->cursor = nir_after_block(block);
/* Set the return flag */
if (state->return_flag == NULL) {
state->return_flag =
nir_local_variable_create(b->impl, glsl_bool_type(), "return");
- /* Set a default value of false */
- state->return_flag->constant_initializer =
- rzalloc(state->return_flag, nir_constant);
+ /* Initialize the variable to 0 */
+ b->cursor = nir_before_cf_list(&b->impl->body);
+ nir_store_var(b, state->return_flag, nir_imm_int(b, NIR_FALSE), 1);
}
+
+ b->cursor = nir_after_block(block);
nir_store_var(b, state->return_flag, nir_imm_int(b, NIR_TRUE), 1);
if (state->loop) {