Mesa (master): radeonsi: set the calling convention for inlined function calls
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 25 01:05:15 UTC 2019
Module: Mesa
Branch: master
Commit: ac4b1e2f0aa987b075be0bac3b4a9e69b5ec4d07
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac4b1e2f0aa987b075be0bac3b4a9e69b5ec4d07
Author: Marek Olšák <marek.olsak at amd.com>
Date: Wed Jun 19 19:00:50 2019 -0400
radeonsi: set the calling convention for inlined function calls
otherwise the behavior is undefined
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de>
---
src/amd/common/ac_llvm_build.c | 8 ++++++++
src/amd/common/ac_llvm_build.h | 3 +++
src/gallium/drivers/radeonsi/si_compute_prim_discard.c | 2 +-
src/gallium/drivers/radeonsi/si_shader.c | 2 +-
4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index edadd56cc7b..92c878acdcf 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -4445,3 +4445,11 @@ ac_build_load_helper_invocation(struct ac_llvm_context *ctx)
result = LLVMBuildNot(ctx->builder, result, "");
return LLVMBuildSExt(ctx->builder, result, ctx->i32, "");
}
+
+LLVMValueRef ac_build_call(struct ac_llvm_context *ctx, LLVMValueRef func,
+ LLVMValueRef *args, unsigned num_args)
+{
+ LLVMValueRef ret = LLVMBuildCall(ctx->builder, func, args, num_args, "");
+ LLVMSetInstructionCallConv(ret, LLVMGetFunctionCallConv(func));
+ return ret;
+}
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index a1654d2b2c4..1928843c78c 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -720,6 +720,9 @@ ac_build_ddxy_interp(struct ac_llvm_context *ctx, LLVMValueRef interp_ij);
LLVMValueRef
ac_build_load_helper_invocation(struct ac_llvm_context *ctx);
+LLVMValueRef ac_build_call(struct ac_llvm_context *ctx, LLVMValueRef func,
+ LLVMValueRef *args, unsigned num_args);
+
LLVMValueRef ac_build_atomic_rmw(struct ac_llvm_context *ctx, LLVMAtomicRMWBinOp op,
LLVMValueRef ptr, LLVMValueRef val,
const char *sync_scope);
diff --git a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c
index 0f2934243a1..28da7b92250 100644
--- a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c
+++ b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c
@@ -667,7 +667,7 @@ void si_build_prim_discard_compute_shader(struct si_shader_context *ctx)
vs_params[param_vertex_id] = index[i];
vs_params[param_instance_id] = instance_id;
- LLVMValueRef ret = LLVMBuildCall(builder, vs, vs_params, num_vs_params, "");
+ LLVMValueRef ret = ac_build_call(&ctx->ac, vs, vs_params, num_vs_params);
for (unsigned chan = 0; chan < 4; chan++)
pos[i][chan] = LLVMBuildExtractValue(builder, ret, chan, "");
}
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index eb75e2a77a4..54b29d0ae01 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -6591,7 +6591,7 @@ static void si_build_wrapper_function(struct si_shader_context *ctx,
out_idx += param_size;
}
- ret = LLVMBuildCall(builder, parts[part], in, num_params, "");
+ ret = ac_build_call(&ctx->ac, parts[part], in, num_params);
if (is_merged_shader(ctx) &&
part + 1 == next_shader_first_part) {
More information about the mesa-commit
mailing list