diff options
author | Tapani Pälli <[email protected]> | 2014-09-09 14:56:06 +0300 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2014-09-11 10:09:12 +0300 |
commit | 096ee4c3b00cf1038830ee5994dd27e9963c24e8 (patch) | |
tree | e508b315da59c82eb7df99ec65de5d9836e3c685 /src | |
parent | 82edcb918be3fdff12af3123269552d0829316ed (diff) |
glsl: mark variable as loop constant when it is set read only
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.
v2: remove unnecessary comment (Francisco)
Signed-off-by: Tapani Pälli <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82537
Tested-by: Michel Dänzer <[email protected]>
Reviewed-by: Anuj Phogat <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/loop_analysis.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/glsl/loop_analysis.h b/src/glsl/loop_analysis.h index 295dc797c09..31be4f3cfa0 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. @@ -216,11 +216,6 @@ public: assert((this->rhs_clean && (this->num_assignments == 1)) || !this->rhs_clean); - /* Variables that are marked read-only *MUST* be loop constant. - */ - assert(!this->var->data.read_only - || (this->var->data.read_only && is_const)); - return is_const; } |