[Mesa-dev] [PATCH 07/31] nir/opt_if: Rework condition propagation

Jose Fonseca jfonseca at vmware.com
Fri Oct 26 18:25:01 UTC 2018


On 22/10/18 23:13, Jason Ekstrand wrote:
> Instead of doing our own constant folding, we just emit instructions and
> let constant folding happen.  This is substantially simpler and lets us
> use the nir_imm_bool helper instead of dealing with the const_value's
> ourselves.
> ---
>   src/compiler/nir/nir_opt_if.c | 91 ++++++++++++-----------------------
>   1 file changed, 30 insertions(+), 61 deletions(-)
> 
> diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c
> index 0c94aa170b5..60368a0259e 100644
> --- a/src/compiler/nir/nir_opt_if.c
> +++ b/src/compiler/nir/nir_opt_if.c
[...]
> +   nir_ssa_def *def[2] = { };

I'm afraid empty struct/array initializers aren't standard C and MSVC 
throws an error.

I really wish there was some GCC warning we could enable for this, as it 
appears to be a common mistake, particularly on nir, probably due to all 
simple POD structs.  But I couldn't find one.

Jose


More information about the mesa-dev mailing list