From: Connor Abbott Date: Wed, 10 Apr 2019 09:34:57 +0000 (+0200) Subject: nir/lower_returns: Use nir control flow insertion helpers X-Git-Tag: upstream/21.0.0~4815 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6f871b62e21343263a7a4c1fd945269e87fd7ee;p=platform%2Fupstream%2Fmesa.git nir/lower_returns: Use nir control flow insertion helpers Reviewed-by: Jason Ekstrand Reviewed-by: Matt Turner Part-of: --- diff --git a/src/compiler/nir/nir_lower_returns.c b/src/compiler/nir/nir_lower_returns.c index 56c7656..ae933e6 100644 --- a/src/compiler/nir/nir_lower_returns.c +++ b/src/compiler/nir/nir_lower_returns.c @@ -55,17 +55,13 @@ predicate_following(nir_cf_node *node, struct lower_returns_state *state) assert(state->return_flag); - nir_if *if_stmt = nir_if_create(b->shader); - if_stmt->condition = nir_src_for_ssa(nir_load_var(b, state->return_flag)); - nir_cf_node_insert(b->cursor, &if_stmt->cf_node); + nir_if *if_stmt = nir_push_if(b, nir_load_var(b, state->return_flag)); if (state->loop) { /* If we're inside of a loop, then all we need to do is insert a * conditional break. */ - nir_jump_instr *brk = - nir_jump_instr_create(state->builder.shader, nir_jump_break); - nir_instr_insert(nir_before_cf_list(&if_stmt->then_list), &brk->instr); + nir_jump(b, nir_jump_break); } else { /* Otherwise, we need to actually move everything into the else case * of the if statement. @@ -76,6 +72,8 @@ predicate_following(nir_cf_node *node, struct lower_returns_state *state) assert(!exec_list_is_empty(&list.list)); nir_cf_reinsert(&list, nir_before_cf_list(&if_stmt->else_list)); } + + nir_pop_if(b, NULL); } static bool