Merge remote-tracking branch 'origin/master' into pipe-video
[mesa.git] / src / glsl / opt_function_inlining.cpp
index a0449a7427a74ddfcc5f662952cea9b2ee7f6728..8fef358cc97b102c68d007bbdc5dcf348d632d69 100644 (file)
@@ -126,7 +126,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
    parameters = new ir_variable *[num_parameters];
 
    /* Generate storage for the return value. */
-   if (this->callee->return_type) {
+   if (!this->callee->return_type->is_void()) {
       retval = new(ctx) ir_variable(this->callee->return_type, "_ret_val",
                                    ir_var_auto);
       next_ir->insert_before(retval);
@@ -165,6 +165,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
 
       /* Move the actual param into our param variable if it's an 'in' type. */
       if (parameters[i] && (sig_param->mode == ir_var_in ||
+                           sig_param->mode == ir_var_const_in ||
                            sig_param->mode == ir_var_inout)) {
         ir_assignment *assign;
 
@@ -208,10 +209,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
    }
 
    /* Now push those new instructions in. */
-   foreach_iter(exec_list_iterator, iter, new_instructions) {
-      ir_instruction *ir = (ir_instruction *)iter.get();
-      next_ir->insert_before(ir);
-   }
+   next_ir->insert_before(&new_instructions);
 
    /* Copy back the value of any 'out' parameters from the function body
     * variables to our own.