summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2016-04-16 23:26:46 +0200
committerRoland Scheidegger <[email protected]>2016-04-18 00:23:34 +0200
commitd11111a5510815afb73f3a863330ddf51d5021df (patch)
treecda31cc2df972d562ff61cba98e6d7074ab8a699
parentb3616f13268ac3d4202b175de087bdad2e592173 (diff)
gallivm: don't use vector selects with llvm 3.7
llvm 3.7 sometimes simply miscompiles vector selects. See https://bugs.freedesktop.org/show_bug.cgi?id=94972 This was fixed in llvm r249669 (https://llvm.org/bugs/show_bug.cgi?id=24532). Reviewed-by: Jose Fonseca <[email protected]>
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_logic.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
index 91f316c4565..620aece997a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
@@ -315,14 +315,16 @@ lp_build_select(struct lp_build_context *bld,
mask = LLVMBuildTrunc(builder, mask, LLVMInt1TypeInContext(lc), "");
res = LLVMBuildSelect(builder, mask, a, b, "");
}
- else if (LLVMIsConstant(mask) ||
- LLVMGetInstructionOpcode(mask) == LLVMSExt) {
+ else if (!(HAVE_LLVM == 0x0307) &&
+ (LLVMIsConstant(mask) ||
+ LLVMGetInstructionOpcode(mask) == LLVMSExt)) {
/* Generate a vector select.
*
* Using vector selects should avoid emitting intrinsics hence avoid
- * hidering optimization passes, but vector selects weren't properly
+ * hindering optimization passes, but vector selects weren't properly
* supported yet for a long time, and LLVM will generate poor code when
* the mask is not the result of a comparison.
+ * Also, llvm 3.7 may miscompile them (bug 94972).
*/
/* Convert the mask to a vector of booleans.