[Mesa-dev] [PATCH] glsl: mark variable as loop constant when it is set read only

Francisco Jerez currojerez at riseup.net
Tue Sep 9 23:32:38 PDT 2014


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:

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140910/7084e885/attachment.sig>


More information about the mesa-dev mailing list