[Mesa-dev] [PATCH 3/5] radeonsi: replace !tbaa with !invariant.load

Tom Stellard tom at stellard.net
Wed Jul 13 19:23:03 UTC 2016


On Tue, Jul 12, 2016 at 10:52:36PM +0200, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
> no change in generated code thanks to dereferenceable(n)
> ---
>  src/gallium/drivers/radeonsi/si_shader.c | 17 +++++------------
>  1 file changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index b23c7c6..ee63b95 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -101,10 +101,9 @@ struct si_shader_context
>  
>  	LLVMTargetMachineRef tm;
>  
> +	unsigned invariant_load_md_kind;
>  	unsigned range_md_kind;
> -	unsigned tbaa_md_kind;
>  	unsigned uniform_md_kind;
> -	LLVMValueRef tbaa_const_md;
>  	LLVMValueRef empty_md;
>  
>  	LLVMValueRef const_buffers[SI_NUM_CONST_BUFFERS];
> @@ -418,7 +417,7 @@ static LLVMValueRef build_indexed_load_const(
>  	LLVMValueRef base_ptr, LLVMValueRef index)
>  {
>  	LLVMValueRef result = build_indexed_load(ctx, base_ptr, index, true);
> -	LLVMSetMetadata(result, ctx->tbaa_md_kind, ctx->tbaa_const_md);
> +	LLVMSetMetadata(result, ctx->invariant_load_md_kind, ctx->empty_md);
>  	return result;
>  }
>  
> @@ -5315,7 +5314,7 @@ static void si_create_function(struct si_shader_context *ctx,
>  		/* The combination of:
>  		 * - ByVal
>  		 * - dereferenceable
> -		 * - tbaa
> +		 * - invariant.load
>  		 * allows the optimization passes to move loads and reduces
>  		 * SGPR spilling significantly.
>  		 */
> @@ -5346,21 +5345,15 @@ static void si_create_function(struct si_shader_context *ctx,
>  static void create_meta_data(struct si_shader_context *ctx)
>  {
>  	struct gallivm_state *gallivm = ctx->radeon_bld.soa.bld_base.base.gallivm;
> -	LLVMValueRef tbaa_const[3];
>  
> +	ctx->invariant_load_md_kind = LLVMGetMDKindIDInContext(gallivm->context,
> +							       "invariant.load", 14);
>  	ctx->range_md_kind = LLVMGetMDKindIDInContext(gallivm->context,
>  						     "range", 5);
> -	ctx->tbaa_md_kind = LLVMGetMDKindIDInContext(gallivm->context,
> -						     "tbaa", 4);
>  	ctx->uniform_md_kind = LLVMGetMDKindIDInContext(gallivm->context,
>  							"amdgpu.uniform", 14);
>  
>  	ctx->empty_md = LLVMMDNodeInContext(gallivm->context, NULL, 0);
> -
> -	tbaa_const[0] = LLVMMDStringInContext(gallivm->context, "const", 5);
> -	tbaa_const[1] = 0;
> -	tbaa_const[2] = lp_build_const_int32(gallivm, 1);
> -	ctx->tbaa_const_md = LLVMMDNodeInContext(gallivm->context, tbaa_const, 3);
>  }
>  
>  static void declare_streamout_params(struct si_shader_context *ctx,
> -- 
> 2.7.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list