radv: fixup botched llvm API changes.
authorDave Airlie <airlied@redhat.com>
Thu, 10 Nov 2016 04:12:32 +0000 (14:12 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 10 Nov 2016 04:12:32 +0000 (14:12 +1000)
Reported-by: Jan Vesely <jan.vesely@rutgers.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_nir_to_llvm.c

index 5468483c486fe9db0354d0c690ed9340c66d647c..35e669ad7e1d7ef8abdba6568d136792f5509f5d 100644 (file)
@@ -296,14 +296,13 @@ create_llvm_function(LLVMContextRef ctx, LLVMModuleRef module,
 
        LLVMSetFunctionCallConv(main_function, RADEON_LLVM_AMDGPU_CS);
        for (unsigned i = 0; i < sgpr_params; ++i) {
-               LLVMValueRef P = LLVMGetParam(main_function, i);
-
                if (i < array_params) {
-                       ac_add_function_attr(P, i + 1, AC_FUNC_ATTR_BYVAL);
+                       LLVMValueRef P = LLVMGetParam(main_function, i);
+                       ac_add_function_attr(main_function, i + 1, AC_FUNC_ATTR_BYVAL);
                        ac_add_attr_dereferenceable(P, UINT64_MAX);
                }
                else {
-                       ac_add_function_attr(P, i + 1, AC_FUNC_ATTR_INREG);
+                       ac_add_function_attr(main_function, i + 1, AC_FUNC_ATTR_INREG);
                }
        }