[Mesa-dev] [PATCH 3/3] radv: set noalias/dereferenceable LLVM attributes based on param types
Samuel Pitoiset
samuel.pitoiset at gmail.com
Fri Jan 25 08:21:33 UTC 2019
Instead of using this useless array_params_mask variable.
This should set these two attributes to streamout buffers too.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/amd/vulkan/radv_nir_to_llvm.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c
index 8058a1dfd9c..de89cd2d880 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -433,7 +433,6 @@ get_tcs_out_current_patch_data_offset(struct radv_shader_context *ctx)
struct arg_info {
LLVMTypeRef types[MAX_ARGS];
LLVMValueRef *assign[MAX_ARGS];
- unsigned array_params_mask;
uint8_t count;
uint8_t sgpr_count;
uint8_t num_sgprs_used;
@@ -464,13 +463,6 @@ add_arg(struct arg_info *info, enum ac_arg_regfile regfile, LLVMTypeRef type,
}
}
-static inline void
-add_array_arg(struct arg_info *info, LLVMTypeRef type, LLVMValueRef *param_ptr)
-{
- info->array_params_mask |= (1 << info->count);
- add_arg(info, ARG_SGPR, type, param_ptr);
-}
-
static void assign_arguments(LLVMValueRef main_function,
struct arg_info *info)
{
@@ -509,10 +501,11 @@ create_llvm_function(LLVMContextRef ctx, LLVMModuleRef module,
LLVMSetFunctionCallConv(main_function, RADEON_LLVM_AMDGPU_CS);
for (unsigned i = 0; i < args->sgpr_count; ++i) {
+ LLVMValueRef P = LLVMGetParam(main_function, i);
+
ac_add_function_attr(ctx, main_function, i + 1, AC_FUNC_ATTR_INREG);
- if (args->array_params_mask & (1 << i)) {
- LLVMValueRef P = LLVMGetParam(main_function, i);
+ if (LLVMGetTypeKind(LLVMTypeOf(P)) == LLVMPointerTypeKind) {
ac_add_function_attr(ctx, main_function, i + 1, AC_FUNC_ATTR_NOALIAS);
ac_add_attr_dereferenceable(P, UINT64_MAX);
}
@@ -723,15 +716,16 @@ declare_global_input_sgprs(struct radv_shader_context *ctx,
while (mask) {
int i = u_bit_scan(&mask);
- add_array_arg(args, type, &ctx->descriptor_sets[i]);
+ add_arg(args, ARG_SGPR, type, &ctx->descriptor_sets[i]);
}
} else {
- add_array_arg(args, ac_array_in_const32_addr_space(type), desc_sets);
+ add_arg(args, ARG_SGPR, ac_array_in_const32_addr_space(type),
+ desc_sets);
}
if (ctx->shader_info->info.loads_push_constants) {
/* 1 for push constants and dynamic descriptors */
- add_array_arg(args, type, &ctx->abi.push_constants);
+ add_arg(args, ARG_SGPR, type, &ctx->abi.push_constants);
}
if (ctx->shader_info->info.so.num_outputs) {
--
2.20.1
More information about the mesa-dev
mailing list