Mesa (master): glsl: Make constant propagation' s folder not propagate into an LHS.
Kenneth Graunke
kwg at kemper.freedesktop.org
Thu Jun 23 18:59:35 UTC 2016
Module: Mesa
Branch: master
Commit: acf544404472488eec85fff249cbface7fa477b1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=acf544404472488eec85fff249cbface7fa477b1
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Mon Jun 20 16:48:02 2016 -0700
glsl: Make constant propagation's folder not propagate into an LHS.
opt_constant_propagation.cpp contains constant folding code which can
actually do constant propagation in some cases. It was happily
propagating constants into the left-hand-side of assignments.
For example,
(assign () (var_ref temp) (constant ...))
would brilliantly be turned into:
(assign () (constant ...) (constant ....))
This is a bigger hammer than necessary - it prevents propagation
into the left-hand-side altogether. We could certainly do better
someday. Notably, the constant propagation pass itself already
takes this approach - it's just the constant propagation pass's
built-in constant folding code (which actually propagates, too)
that was broken.
No change in shader-db, but prevents regressions after future commits.
It seems plausible that this could be hit today, but I haven't seen it
happen.
Cc: mesa-stable at lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>
---
src/compiler/glsl/opt_constant_propagation.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compiler/glsl/opt_constant_propagation.cpp b/src/compiler/glsl/opt_constant_propagation.cpp
index fbc22b0..6ec4ab4 100644
--- a/src/compiler/glsl/opt_constant_propagation.cpp
+++ b/src/compiler/glsl/opt_constant_propagation.cpp
@@ -138,7 +138,7 @@ public:
void
ir_constant_propagation_visitor::constant_folding(ir_rvalue **rvalue)
{
- if (*rvalue == NULL)
+ if (this->in_assignee || *rvalue == NULL)
return;
if (ir_constant_fold(rvalue))
More information about the mesa-commit
mailing list