summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2013-10-22 09:26:12 -0700
committerTom Stellard <[email protected]>2013-10-30 16:40:06 -0700
commit6f3465f340b5e2b1419330f2c1fcb61fbe087af7 (patch)
treee7f22bcb70ab594e31f14a04aabe3b7ff6929584
parent20dbeadd83ffca2345c4ba1f1ac27c19bade0d4a (diff)
radeon/llvm: Specify the DataLayout when running optimizations
Without DataLayout, a lot of optimization passes aren't run and the ones that are don't work as well.
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/radeon_llvm_util.c b/src/gallium/drivers/radeon/radeon_llvm_util.c
index 25be2459366..7192dee9732 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);