[Mesa-dev] [PATCH] nir/algebraic: Add optimizations for "a == a && a CMP b"

Gustaw Smolarczyk wielkiegie at gmail.com
Tue Dec 20 08:49:09 UTC 2016


2016-12-20 6:32 GMT+01:00 Jason Ekstrand <jason at jlekstrand.net>:
> This sequence shows up The Talos Principal, at least under Vulkan,
> and prevents loop analysis from properly computing trip counts in a
> few loops.
> ---
>  src/compiler/nir/nir_opt_algebraic.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
> index 698ac67..cc70ad5 100644
> --- a/src/compiler/nir/nir_opt_algebraic.py
> +++ b/src/compiler/nir/nir_opt_algebraic.py
> @@ -464,6 +464,14 @@ def bitfield_reverse(u):
>
>  optimizations += [(bitfield_reverse('x at 32'), ('bitfield_reverse', 'x'))]
>
> +# For any comparison operation, "cmp", if you have "a != a && a cmp b" then
> +# the "a != a" is redundant because it's equivalent to "a is not NaN" and, if

Shouldn't the comment have a == a ?

Regards,
Gustaw


More information about the mesa-dev mailing list