[Mesa-dev] [PATCH] st/clover: Fix build against LLVM SVN >= r215967 v2

Francisco Jerez currojerez at riseup.net
Thu Aug 21 05:02:51 PDT 2014


Tom Stellard <thomas.stellard at amd.com> writes:

> From: Michel Dänzer <michel.daenzer at amd.com>
>
> v2: Tom Stellard
>   - Properly destroy the Module

Thanks,

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

> ---
>  src/gallium/state_trackers/clover/llvm/invocation.cpp | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> index 5d2efc4..d351bc5 100644
> --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> @@ -234,7 +234,11 @@ namespace {
>        memcpy(address_spaces, c.getTarget().getAddressSpaceMap(),
>                                                          sizeof(address_spaces));
>  
> +#if HAVE_LLVM >= 0x0306
> +      return act.takeModule().release();
> +#else
>        return act.takeModule();
> +#endif
>     }
>  
>     void
> @@ -415,13 +419,21 @@ clover::compile_program_llvm(const compat::string &source,
>  
>     internalize_functions(mod, kernels);
>  
> +   module m;
>     // Build the clover::module
>     switch (ir) {
>        case PIPE_SHADER_IR_TGSI:
>           //XXX: Handle TGSI
>           assert(0);
> -         return module();
> +         m = module();
> +         break;
>        default:
> -         return build_module_llvm(mod, kernels, address_spaces);
> +         m = build_module_llvm(mod, kernels, address_spaces);
> +         break;
>     }
> +#if HAVE_LLVM >= 0x0306
> +   // LLVM 3.6 and newer, the user takes ownership of the module.
> +   delete mod;
> +#endif
> +   return m;
>  }
> -- 
> 1.8.5.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140821/d047584f/attachment-0001.sig>


More information about the mesa-dev mailing list