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

Anuj Phogat anuj.phogat at gmail.com
Tue Sep 9 15:47:56 PDT 2014


On Tue, Sep 9, 2014 at 4:56 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
> 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);
>
>        /* 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

Looks fine to me.
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list