On 03/14/2017 10:21 PM, Dave Airlie wrote:
On 15 March 2017 at 07:17, Dave Airlie <airl...@gmail.com> wrote:
From: Dave Airlie <airl...@redhat.com>

LLVM 4.0 released with a pretty messy regression, that hopefully
get fixed in the future.

This work around was proposed by Tom, and it fixes the CTS regressions
here at least, I'm not sure if this will cause any major side effects,
but correctness over speed and all that.

radeonsi should possibly consider the same workaround until an llvm
fix can be found.


I also deliberately only put this for LLVM 4.0 in the hope llvm will
get fixed before
5 releases.

I think you want to make it >= 0x0400 and change it later because it's still broken with LLVM master.


Dave.

Signed-off-by: Dave Airlie <airl...@redhat.com>
---
 src/amd/common/ac_llvm_util.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c
index a2fe631..da12aaa 100644
--- a/src/amd/common/ac_llvm_util.c
+++ b/src/amd/common/ac_llvm_util.c
@@ -26,7 +26,7 @@
 #include "ac_llvm_util.h"
 #include "util/bitscan.h"
 #include <llvm-c/Core.h>
-
+#include <llvm-c/Support.h>
 #include "c11/threads.h"

 #include <assert.h>
@@ -39,6 +39,17 @@ static void ac_init_llvm_target()
        LLVMInitializeAMDGPUTarget();
        LLVMInitializeAMDGPUTargetMC();
        LLVMInitializeAMDGPUAsmPrinter();
+
+       /*
+        * Workaround for bug in llvm 4.0 that causes image intrinsics
+        * to disappear.
+        * https://reviews.llvm.org/D26348
+        */
+#if HAVE_LLVM == 0x0400
+       const char *argv[2] = {"mesa", "-simplifycfg-sink-common=false"};
+       LLVMParseCommandLineOptions(2, argv, NULL);
+#endif
+
 }

 static once_flag ac_init_llvm_target_once_flag = ONCE_FLAG_INIT;
--
2.9.3

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

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

Reply via email to