diff options
author | Dave Airlie <[email protected]> | 2017-03-14 06:50:59 +1000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-03-16 01:34:01 +0000 |
commit | ed5c3fad3778d338f0f886e87381bd9e1d3737cf (patch) | |
tree | 1004987616d7b8839364b52204c6d612063da54a | |
parent | cc917075b52e5f9590cd23529ab0ead8b76cdd15 (diff) |
radv: setup llvm target data layout
Ported from radeonsi, pointed out by Tom.
"This prevents LLVM from using sext instructions for local memory
offsets and allows the backend to fold immediate offsets into the
instruction. This also prevents some incorrect code generation for
ptrtoint and inttoptr instructions."
Cc: "13.0 17.0" <[email protected]>
Reviewed-by: Tom Stellard <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
(cherry picked from commit b8ee70384adc3286d18febba7a92047118cc0f0f)
[Emil Velikov: resolve trivial conflicts]
Signed-off-by: Emil Velikov <[email protected]>
Conflicts:
src/amd/common/ac_nir_to_llvm.c
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 386944cc1d3..5b8ee720b57 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -4461,6 +4461,13 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm, memset(shader_info, 0, sizeof(*shader_info)); LLVMSetTarget(ctx.module, "amdgcn--"); + + LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(tm); + char *data_layout_str = LLVMCopyStringRepOfTargetData(data_layout); + LLVMSetDataLayout(ctx.module, data_layout_str); + LLVMDisposeTargetData(data_layout); + LLVMDisposeMessage(data_layout_str); + setup_types(&ctx); ctx.builder = LLVMCreateBuilderInContext(ctx.context); |