summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/opt_rebalance_tree.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-17 14:44:57 -0700
committerJason Ekstrand <[email protected]>2016-03-23 16:28:07 -0700
commit028d6ecfe0feecd1e543322d2953bef810f13d23 (patch)
treedac7b9a925cef34537d92c0710d0ee26fe00bbec /src/compiler/glsl/opt_rebalance_tree.cpp
parentb2209b2333e71549f4101d3d1193c7a2df4e1c14 (diff)
glsl/rebalance_tree: Don't handle invariant or precise trees
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/compiler/glsl/opt_rebalance_tree.cpp')
-rw-r--r--src/compiler/glsl/opt_rebalance_tree.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compiler/glsl/opt_rebalance_tree.cpp b/src/compiler/glsl/opt_rebalance_tree.cpp
index 095f2d7d2f0..8045d51033d 100644
--- a/src/compiler/glsl/opt_rebalance_tree.cpp
+++ b/src/compiler/glsl/opt_rebalance_tree.cpp
@@ -131,6 +131,8 @@ public:
progress = false;
}
+ virtual ir_visitor_status visit_enter(ir_assignment *ir);
+
void handle_rvalue(ir_rvalue **rvalue);
bool progress;
@@ -146,6 +148,20 @@ struct is_reduction_data {
} /* anonymous namespace */
+ir_visitor_status
+ir_rebalance_visitor::visit_enter(ir_assignment *ir)
+{
+ ir_variable *var = ir->lhs->variable_referenced();
+ if (var->data.invariant || var->data.precise) {
+ /* If we're assigning to an invariant variable, just bail. Tree
+ * rebalancing (reassociation) isn't precision-safe.
+ */
+ return visit_continue_with_parent;
+ } else {
+ return visit_continue;
+ }
+}
+
static bool
is_reduction_operation(ir_expression_operation operation)
{