[Mesa-dev] [PATCH] clover: Fix build against LLVM SVN >= r266163

Francisco Jerez currojerez at riseup.net
Wed Apr 13 18:59:44 UTC 2016


Michel Dänzer <michel at daenzer.net> writes:

> From: Michel Dänzer <michel.daenzer at amd.com>
>
> createInternalizePass now takes a callback instead of a StringSet.
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>  src/gallium/state_trackers/clover/llvm/invocation.cpp | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> index 4d11c24..97acd03 100644
> --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> @@ -322,6 +322,18 @@ namespace {
>        // list of kernel functions to the internalizer.  The internalizer will
>        // treat the functions in the list as "main" functions and internalize
>        // all of the other functions.
> +#if HAVE_LLVM >= 0x0309
> +      auto preserve_kernels = [=](const llvm::GlobalValue &GV) {
> +         for (std::vector<llvm::Function *>::const_iterator I = kernels.begin(),
> +                                                            E = kernels.end();
> +                                                            I != E; ++I) {
> +            llvm::Function *kernel = *I;

'for (const auto &kernel : kernels) {' instead of the last four lines of
code?  With my style nitpick taken into account:

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

> +            if (GV.getName() == kernel->getName())
> +               return true;
> +         }
> +         return false;
> +      };
> +#else
>        std::vector<const char*> export_list;
>        for (std::vector<llvm::Function *>::const_iterator I = kernels.begin(),
>                                                           E = kernels.end();
> @@ -329,12 +341,17 @@ namespace {
>           llvm::Function *kernel = *I;
>           export_list.push_back(kernel->getName().data());
>        }
> +#endif
>  #if HAVE_LLVM < 0x0306
>        PM.add(new llvm::DataLayoutPass(mod));
>  #elif HAVE_LLVM < 0x0307
>        PM.add(new llvm::DataLayoutPass());
>  #endif
> +#if HAVE_LLVM >= 0x0309
> +      PM.add(llvm::createInternalizePass(preserve_kernels));
> +#else
>        PM.add(llvm::createInternalizePass(export_list));
> +#endif
>  
>        llvm::PassManagerBuilder PMB;
>        PMB.OptLevel = optimization_level;
> -- 
> 2.8.0.rc3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160413/44d4cee8/attachment.sig>


More information about the mesa-dev mailing list