From: Dave Airlie Date: Tue, 14 Mar 2017 21:15:50 +0000 (+1000) Subject: radv/ac: workaround regression in llvm 4.0 release X-Git-Tag: android-x86-7.1-r1~1464 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7372e3cf5f2df9dd2ec0423a4425baad098bf326;p=android-x86%2Fexternal-mesa.git radv/ac: workaround regression in llvm 4.0 release 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. Acked-by: Bas Nieuwenhuizen Signed-off-by: Dave Airlie --- diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c index a2fe631c00f..3687e98c85f 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 - +#include #include "c11/threads.h" #include @@ -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;