[Mesa-dev] [PATCH 1/3] gallivm: remove lp_add_attr_dereferenceable in favor of amd/common

Dave Airlie airlied at gmail.com
Tue Mar 21 22:41:51 UTC 2017


On 22 March 2017 at 08:18, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>

For the first 2,

Reviewed-by: Dave Airlie <airlied at redhat.com>
>
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 11 -----------
>  src/gallium/auxiliary/gallivm/lp_bld_misc.h   |  3 ---
>  src/gallium/drivers/radeonsi/si_shader.c      |  2 +-
>  3 files changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> index 444686f..2a388cb 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -740,31 +740,20 @@ lp_get_default_memory_manager()
>     return reinterpret_cast<LLVMMCJITMemoryManagerRef>(mm);
>  }
>
>  extern "C"
>  void
>  lp_free_memory_manager(LLVMMCJITMemoryManagerRef memorymgr)
>  {
>     delete reinterpret_cast<BaseMemoryManager*>(memorymgr);
>  }
>
> -extern "C" void
> -lp_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
> -{
> -#if HAVE_LLVM >= 0x0306
> -   llvm::Argument *A = llvm::unwrap<llvm::Argument>(val);
> -   llvm::AttrBuilder B;
> -   B.addDereferenceableAttr(bytes);
> -   A->addAttr(llvm::AttributeSet::get(A->getContext(), A->getArgNo() + 1,  B));
> -#endif
> -}
> -
>  extern "C" LLVMValueRef
>  lp_get_called_value(LLVMValueRef call)
>  {
>  #if HAVE_LLVM >= 0x0309
>         return LLVMGetCalledValue(call);
>  #elif HAVE_LLVM >= 0x0305
>         return llvm::wrap(llvm::CallSite(llvm::unwrap<llvm::Instruction>(call)).getCalledValue());
>  #else
>         return NULL; /* radeonsi doesn't support so old LLVM. */
>  #endif
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
> index 6abb30d..dafb4cf 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
> @@ -66,23 +66,20 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
>
>  extern void
>  lp_free_generated_code(struct lp_generated_code *code);
>
>  extern LLVMMCJITMemoryManagerRef
>  lp_get_default_memory_manager();
>
>  extern void
>  lp_free_memory_manager(LLVMMCJITMemoryManagerRef memorymgr);
>
> -extern void
> -lp_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
> -
>  extern LLVMValueRef
>  lp_get_called_value(LLVMValueRef call);
>
>  extern bool
>  lp_is_function(LLVMValueRef v);
>
>  enum lp_float_mode {
>     LP_FLOAT_MODE_DEFAULT,
>     LP_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH,
>     LP_FLOAT_MODE_UNSAFE_FP_MATH,
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 93b6a6e..580781bd 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -5279,21 +5279,21 @@ static void si_create_function(struct si_shader_context *ctx,
>                 /* The combination of:
>                  * - ByVal
>                  * - dereferenceable
>                  * - invariant.load
>                  * allows the optimization passes to move loads and reduces
>                  * SGPR spilling significantly.
>                  */
>                 if (LLVMGetTypeKind(LLVMTypeOf(P)) == LLVMPointerTypeKind) {
>                         lp_add_function_attr(ctx->main_fn, i + 1, LP_FUNC_ATTR_BYVAL);
>                         lp_add_function_attr(ctx->main_fn, i + 1, LP_FUNC_ATTR_NOALIAS);
> -                       lp_add_attr_dereferenceable(P, UINT64_MAX);
> +                       ac_add_attr_dereferenceable(P, UINT64_MAX);
>                 } else
>                         lp_add_function_attr(ctx->main_fn, i + 1, LP_FUNC_ATTR_INREG);
>         }
>
>         LLVMAddTargetDependentFunctionAttr(ctx->main_fn,
>                                            "no-signed-zeros-fp-math",
>                                            "true");
>
>         if (ctx->screen->b.debug_flags & DBG_UNSAFE_MATH) {
>                 /* These were copied from some LLVM test. */
> --
> 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