[Mesa-dev] [i915g] i915_fpc_optimize_useless_mov is invalid in the general case
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.xyz = MUL R, T_DIFFUSE
>> > This does yield the correct result in R.xyz, but it does (of course)
>> > not update R.xyz, which is a problem, because R.xyzz is used in
>> > line 16. In this special case, we could get away with renaming R.xyzz
>> > into R.xyzz in line 16, but in the general case, there is no warranty
>> > that R.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.xyz keeps unchanged in all further lines,
> so it is a valid replacement for the elided R.xyz? The fragment
> shader language is not static single assignment, so R 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.
More information about the mesa-dev