i965/vec4: split VEC4_OPCODE_FROM_DOUBLE into one opcode per destination's type
[mesa.git] / src / compiler / glsl / opt_constant_variable.cpp
index 3ddb12904c7fce7179990e94477b4204d890e6aa..1c06ffe6750aa5460de5fb7b1ec8077a71108573 100644 (file)
@@ -102,6 +102,13 @@ ir_constant_variable_visitor::visit_enter(ir_assignment *ir)
    assert(entry);
    entry->assignment_count++;
 
+   /* If there's more than one assignment, don't bother - we won't do anything
+    * with this variable anyway, and continuing just wastes memory cloning
+    * constant expressions.
+    */
+   if (entry->assignment_count > 1)
+      return visit_continue;
+
    /* If it's already constant, don't do the work. */
    if (entry->var->constant_value)
       return visit_continue;