[Mesa-dev] [PATCH] glsl: mark variable as loop constant when it is set read only
Tapani
tapani.palli at intel.com
Wed Sep 10 04:11:10 PDT 2014
On 09/10/2014 09:32 AM, Francisco Jerez wrote:
> Tapani Pälli <tapani.palli at intel.com> writes:
>
>> Patch modifies is_loop_constant() to take advantage of 'read_only' bit
>> in ir_variable to detect a loop constant. Variables marked read-only
>> are loop constant like mentioned by a comment in the function.
>>
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82537
>> ---
>> src/glsl/loop_analysis.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/glsl/loop_analysis.h b/src/glsl/loop_analysis.h
>> index 295dc79..8e2979c 100644
>> --- a/src/glsl/loop_analysis.h
>> +++ b/src/glsl/loop_analysis.h
>> @@ -205,10 +205,10 @@ public:
>> inline bool is_loop_constant() const
>> {
>> const bool is_const = (this->num_assignments == 0)
>> - || ((this->num_assignments == 1)
>> + || (((this->num_assignments == 1)
>> && !this->conditional_or_nested_assignment
>> && !this->read_before_write
>> - && this->rhs_clean);
>> + && this->rhs_clean) || this->var->data.read_only);
>>
> The assertion a few lines below now seems tautological. Without it this
> patch is:
True, I left it there as 'documentation' but can be removed, don't have
a strong opinion.
> Reviewed-by: Francisco Jerez <currojerez at riseup.net>
>
>> /* If the RHS of *the* assignment is clean, then there must be exactly
>> * one assignment of the variable.
>> --
>> 1.9.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list