[Mesa-dev] [PATCH 3/4] i965/vs: Add simple dead code elimination.

Kenneth Graunke kenneth at whitecape.org
Fri Aug 19 14:21:43 PDT 2011


On 08/19/2011 10:58 AM, Dan McCabe wrote:
> On 08/18/2011 01:23 PM, Kenneth Graunke wrote:
>> On 08/18/2011 12:02 PM, Matt Turner wrote:
>>> On Thu, Aug 18, 2011 at 2:38 PM, Eric Anholt<eric at anholt.net>  wrote:
>>>> +   bool progress = true;
>>>> +   while (progress) {
>>>> +      progress = false;
>>>> +      progress = dead_code_eliminate() || progress;
>>>
>>> || progress is always false, though maybe it's just written like that
>>> to match the style of the code.
>>>
>>> I'd have just written this as
>>>
>>> bool progress;
>>> do {
>>>      progress = dead_code_eliminate();
>>> } while (progress)
>>>
>>> Matt
>>
>> The idea is that we'll add more passes later, so eventually, progress
>> won't just be false.  Using the do-while loop is probably clearer though.
> 
> If that's the case (that we'll add more passes later), this should have
> been noted in the commit msg. It would have prevented people from
> scratching their heads about the logic.

Well...it's basically mirroring the equivalent loops in brw_fs and the
GLSL compiler's do_common_optimization function.  So it looked pretty
familiar to me.


More information about the mesa-dev mailing list