Module: Mesa
Branch: master
Commit: 226a2c6d6eaa94919aa865edfe207c615bc741e7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=226a2c6d6eaa94919aa865edfe207c615bc741e7

Author: Tom Stellard <thomas.stell...@amd.com>
Date:   Wed Feb  1 00:18:01 2017 +0000

radeonsi: Fix build on LLVM < 3.9 v2

This was broken by: e0cc0a614c96011958bc3a1b84da9168e0e1ccbb

v2:
  - Use preprocessor macro

Tested-by: Mark Janes <mark.a.ja...@intel.com>

---

 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 205686a..c7445e0 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -1256,8 +1256,6 @@ void si_llvm_context_init(struct si_shader_context *ctx,
                          const struct tgsi_token *tokens)
 {
        struct lp_type type;
-       LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(tm);
-       char *data_layout_str = LLVMCopyStringRepOfTargetData(data_layout);
 
        /* Initialize the gallivm object:
         * We are only using the module, context, and builder fields of this 
struct.
@@ -1275,9 +1273,13 @@ void si_llvm_context_init(struct si_shader_context *ctx,
                                                ctx->gallivm.context);
        LLVMSetTarget(ctx->gallivm.module, "amdgcn--");
 
+#if HAVE_LLVM >= 0x0309
+       LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(tm);
+       char *data_layout_str = LLVMCopyStringRepOfTargetData(data_layout);
        LLVMSetDataLayout(ctx->gallivm.module, data_layout_str);
        LLVMDisposeTargetData(data_layout);
        LLVMDisposeMessage(data_layout_str);
+#endif
 
        bool unsafe_fpmath = (sscreen->b.debug_flags & DBG_UNSAFE_MATH) != 0;
        ctx->gallivm.builder = lp_create_builder(ctx->gallivm.context,

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to