On Thu, Jul 7, 2016 at 7:01 PM, Connor Abbott <cwabbo...@gmail.com> wrote:
> On Thu, Jul 7, 2016 at 12:57 PM, Erik Faye-Lund <kusmab...@gmail.com> wrote:
>> On Thu, Jul 7, 2016 at 2:12 AM, Eric Anholt <e...@anholt.net> wrote:
>>> This was appearing in vc4 VS/CS in mupen64, due to vertex attrib lowering
>>> producing some constants that were getting compared.
>>>
>>> total instructions in shared programs: 112276 -> 112198 (-0.07%)
>>> instructions in affected programs:     2239 -> 2161 (-3.48%)
>>> total estimated cycles in shared programs: 283102 -> 283038 (-0.02%)
>>> estimated cycles in affected programs:     2365 -> 2301 (-2.71%)
>>> ---
>>>  src/compiler/nir/nir_opt_algebraic.py | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/src/compiler/nir/nir_opt_algebraic.py 
>>> b/src/compiler/nir/nir_opt_algebraic.py
>>> index fd228017c54e..7d04ef941b73 100644
>>> --- a/src/compiler/nir/nir_opt_algebraic.py
>>> +++ b/src/compiler/nir/nir_opt_algebraic.py
>>> @@ -197,6 +197,7 @@ optimizations = [
>>>     (('iand', a, 0), 0),
>>>     (('ior', a, a), a),
>>>     (('ior', a, 0), a),
>>> +   (('ior', a, True), True),
>>
>> Is it guaranteed that evaluating 'a' doesn't have side-effects at this point?
>
> Yes, since "a" is just an arbitrary SSA value being matched. The
> short-circuiting behavior of || and && is handled very early on,
> during the AST -> GLSL IR translation, by turning them into if
> statements.

Cool, thanks for clarifying. Short-circuiting is indeed what I was
worried about, and I guess as you say SSA makes this trivial to do.
Great stuff :)
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to