From ce9fb286eaae818caed3f9dfe18ed7dd8dae774b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Tue, 9 Sep 2014 13:28:53 +0300 Subject: [PATCH] glsl: mark variable as loop constant when it is set read only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When called, rhs_clean might be false but 'read_only' bit can be used to detect loop constant like mentioned by the comment in the function. Signed-off-by: Tapani Pälli 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.8.3.1