Reviewed-by: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>

On Mon, Mar 13, 2017 at 9:52 PM, Dave Airlie <airl...@gmail.com> wrote:
> From: Dave Airlie <airl...@redhat.com>
>
> Ported from radeonsi, pointed out by Tom.
>
> "This prevents LLVM from using sext instructions for local memory
> offsets and allows the backend to fold immediate offsets into the
> instruction. This also prevents some incorrect code generation for
> ptrtoint and inttoptr instructions."
>
> Signed-off-by: Dave Airlie <airl...@redhat.com>
> ---
>  src/amd/common/ac_nir_to_llvm.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 47091a2..417b34e 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -4911,6 +4911,13 @@ LLVMModuleRef 
> ac_translate_nir_to_llvm(LLVMTargetMachineRef tm,
>         memset(shader_info, 0, sizeof(*shader_info));
>
>         LLVMSetTarget(ctx.module, options->supports_spill ? 
> "amdgcn-mesa-mesa3d" : "amdgcn--");
> +
> +       LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(tm);
> +       char *data_layout_str = LLVMCopyStringRepOfTargetData(data_layout);
> +       LLVMSetDataLayout(ctx.module, data_layout_str);
> +       LLVMDisposeTargetData(data_layout);
> +       LLVMDisposeMessage(data_layout_str);
> +
>         setup_types(&ctx);
>
>         ctx.builder = LLVMCreateBuilderInContext(ctx.context);
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to