Mesa (master): radeonsi: fix a regression in si_eliminate_const_output

Nicolai Hähnle nh at kemper.freedesktop.org
Fri Oct 21 08:17:37 UTC 2016


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

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Thu Oct 20 13:05:40 2016 +0200

radeonsi: fix a regression in si_eliminate_const_output

A constant value of float type is not necessarily a ConstantFP: it could also
be a constant expression that for some reason hasn't been folded.

This fixes a regression in GL45-CTS.arrays_of_arrays_gl.InteractionFunctionCalls2
that was introduced by commit 3ec9975555d1cc5365413ad9062f412904f944a3.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/drivers/radeonsi/si_shader.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 25449ec..8edd593 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -6535,14 +6535,12 @@ static bool si_eliminate_const_output(struct si_shader_context *ctx,
 	for (i = 0; i < 4; i++) {
 		LLVMBool loses_info;
 		LLVMValueRef p = LLVMGetOperand(inst, 5 + i);
-		if (!LLVMIsConstant(p))
-			return false;
 
 		/* It's a constant expression. Undef outputs are eliminated too. */
 		if (LLVMIsUndef(p)) {
 			is_zero[i] = true;
 			is_one[i] = true;
-		} else {
+		} else if (LLVMIsAConstantFP(p)) {
 			double a = LLVMConstRealGetDouble(p, &loses_info);
 
 			if (a == 0)
@@ -6551,7 +6549,8 @@ static bool si_eliminate_const_output(struct si_shader_context *ctx,
 				is_one[i] = true;
 			else
 				return false; /* other constant */
-		}
+		} else
+			return false;
 	}
 
 	/* Only certain combinations of 0 and 1 can be eliminated. */




More information about the mesa-commit mailing list