[Mesa-dev] [i915g] i915_fpc_optimize_useless_mov is invalid in the general case

Stéphane Marchesin stephane.marchesin at gmail.com
Mon Dec 5 13:12:07 PST 2011


2011/12/5 Michael Karcher <freedesktop-bugzilla at mkarcher.dialup.fu-berlin.de>:
> Am Montag, den 05.12.2011, 13:03 -0800 schrieb Stéphane Marchesin:
>> > This translation is correct. The mentioned optimization now kicks in
>> > corrrectly removing line 9, but it also reokaces line 6/7 by
>> >  6: R[1].xyz = MUL R[0], T_DIFFUSE
>> > This does yield the correct result in R[1].xyz, but it does (of course)
>> > not update R[0].xyz, which is a problem, because R[0].xyzz is used in
>> > line 16. In this special case, we could get away with renaming R[0].xyzz
>> > into R[1].xyzz in line 16, but in the general case, there is no warranty
>> > that R[1].xyz still contains in line 16 what it did in line 7.
>> >
>> > Any suggestions? Just remove this optimization? Improve the optimizer to
>> > have it check that the eliminated temporary is not used in any further
>> > lines?
>>
>> Yeah we need to replace the temporary in all further lines. Patches welcome.
> Thanks for your quick response!
>
> How can you be sure that R[1].xyz keeps unchanged in all further lines,
> so it is a valid replacement for the elided R[0].xyz? The fragment
> shader language is not static single assignment, so R[1] could already
> have been reused for a different purpose.
>

Yeah, I have been working on a liveness analysis branch to solve that.
As a quicker fix we could just disable the optimization when the
register gets touched later.

Stéphane


More information about the mesa-dev mailing list