Merge branch 'llvm-cliptest-viewport'
[mesa.git] / src / glsl / ir_function_inlining.cpp
index 56d29e3fd166eb43d856e12aa5c871500e6f7ab1..147c1824c1a06f5a450e92949336b35193e9e9c5 100644 (file)
@@ -27,7 +27,7 @@
  * Replaces calls to functions with the body of the function.
  */
 
-#include <stdint.h>
+#include <inttypes.h>
 #include "ir.h"
 #include "ir_visitor.h"
 #include "ir_function_inlining.h"
@@ -153,6 +153,13 @@ ir_call::generate_inline(ir_instruction *next_ir)
       } else {
         parameters[i] = sig_param->clone(ctx, ht);
         parameters[i]->mode = ir_var_auto;
+
+        /* Remove the read-only decoration becuase we're going to write
+         * directly to this variable.  If the cloned variable is left
+         * read-only and the inlined function is inside a loop, the loop
+         * analysis code will get confused.
+         */
+        parameters[i]->read_only = false;
         next_ir->insert_before(parameters[i]);
       }