[Mesa-dev] [PATCH] radeon/llvm: Specify the DataLayout when running optimizations
Aaron Watry
awatry at gmail.com
Mon Oct 28 14:39:28 CET 2013
I ran this through a piglit CL test run on my 7850, no test fixes or
regressions.
--Aaron
On Tue, Oct 22, 2013 at 11:28 AM, Tom Stellard <tom at stellard.net> wrote:
> From: Tom Stellard <thomas.stellard at amd.com>
>
> Without DataLayout, a lot of optimization passes aren't run and the ones
> that are don't work as well.
> ---
> src/gallium/drivers/radeon/radeon_llvm_util.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/src/gallium/drivers/radeon/radeon_llvm_util.c b/src/gallium/drivers/radeon/radeon_llvm_util.c
> index 25be245..7192dee 100644
> --- a/src/gallium/drivers/radeon/radeon_llvm_util.c
> +++ b/src/gallium/drivers/radeon/radeon_llvm_util.c
> @@ -29,6 +29,7 @@
>
> #include <llvm-c/BitReader.h>
> #include <llvm-c/Core.h>
> +#include <llvm-c/Target.h>
> #include <llvm-c/Transforms/PassManagerBuilder.h>
>
> LLVMModuleRef radeon_llvm_parse_bitcode(const unsigned char * bitcode,
> @@ -53,8 +54,11 @@ unsigned radeon_llvm_get_num_kernels(const unsigned char *bitcode,
>
> static void radeon_llvm_optimize(LLVMModuleRef mod)
> {
> + const char *data_layout = LLVMGetDataLayout(mod);
> + LLVMTargetDataRef TD = LLVMCreateTargetData(data_layout);
> LLVMPassManagerBuilderRef builder = LLVMPassManagerBuilderCreate();
> LLVMPassManagerRef pass_manager = LLVMCreatePassManager();
> + LLVMAddTargetData(TD, pass_manager);
>
> LLVMPassManagerBuilderUseInlinerWithThreshold(builder, 1000000000);
> LLVMPassManagerBuilderPopulateModulePassManager(builder, pass_manager);
> --
> 1.7.11.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list