Re: [Mesa-dev] [PATCH 4/8] nir/lower_returns: Stop using constant initializers

2016-07-21 Thread Iago Toral
I guess this isn't really necessary since we are going to lower
constant initializers away eventually, right? I have no objections to
saving the pass some work of course, just wondering if that's really
all there is to this change or if I am missing something else.

Iago

On Wed, 2016-07-20 at 15:28 -0700, Jason Ekstrand wrote:
> Signed-off-by: Jason Ekstrand 
> ---
>  src/compiler/nir/nir_lower_returns.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/compiler/nir/nir_lower_returns.c
> b/src/compiler/nir/nir_lower_returns.c
> index 8dbea6e..cf49d5b 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(>instr);
>  
> nir_builder *b = >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(>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) {
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/8] nir/lower_returns: Stop using constant initializers

2016-07-20 Thread Jason Ekstrand
Signed-off-by: Jason Ekstrand 
---
 src/compiler/nir/nir_lower_returns.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/compiler/nir/nir_lower_returns.c 
b/src/compiler/nir/nir_lower_returns.c
index 8dbea6e..cf49d5b 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(>instr);
 
nir_builder *b = >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(>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) {
-- 
2.5.0.400.gff86faf

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev