diff options
author | Rafael Ávila de Espíndola <[email protected]> | 2014-09-16 03:46:02 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2014-09-16 03:50:32 +0200 |
commit | f6e71ff9eb44ed87bd6ac5cc705076d1a789d0ea (patch) | |
tree | 8e282d334e5fd4846dabc109886e740c8ce5727c /src/gallium/auxiliary | |
parent | 145fef9636a7f6a1b371861a887657cef21bdb3d (diff) |
gallivm: attach DataLayout to module too, not just pass manager.
It looks like it was possible to attach it to both for a long time, however
since llvm r217548 attaching it to just the pass manager is no longer
sufficient and causes bugs (see http://llvm.org/bugs/show_bug.cgi?id=20903).
Tested-by: Vinson Lee <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_init.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index ce87b8ce932..243d24891da 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -139,6 +139,7 @@ enum LLVM_CodeGenOpt_Level { static boolean create_pass_manager(struct gallivm_state *gallivm) { + char *td_str; assert(!gallivm->passmgr); assert(gallivm->target); @@ -146,8 +147,14 @@ create_pass_manager(struct gallivm_state *gallivm) if (!gallivm->passmgr) return FALSE; + // Old versions of LLVM get the DataLayout from the pass manager. LLVMAddTargetData(gallivm->target, gallivm->passmgr); + // New ones from the Module. + td_str = LLVMCopyStringRepOfTargetData(gallivm->target); + LLVMSetDataLayout(gallivm->module, td_str); + free(td_str); + if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) { /* These are the passes currently listed in llvm-c/Transforms/Scalar.h, * but there are more on SVN. |