Mesa (master): nir: Pull nir_instr_can_cse()' s SSA checks out of the switch.
Kenneth Graunke
kwg at kemper.freedesktop.org
Fri Jan 23 22:55:22 UTC 2015
Module: Mesa
Branch: master
Commit: cbdd623f13a3cd2b7cfc5aea2185eee7d7d53c1a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cbdd623f13a3cd2b7cfc5aea2185eee7d7d53c1a
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Wed Jan 21 12:20:59 2015 -0800
nir: Pull nir_instr_can_cse()'s SSA checks out of the switch.
This should not be a change in behavior, as all current cases that
potentially answer "yes" require SSA.
The next patch will introduce another case that requires SSA.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
---
src/glsl/nir/nir_opt_cse.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/glsl/nir/nir_opt_cse.c b/src/glsl/nir/nir_opt_cse.c
index a33ebdd..fef1678 100644
--- a/src/glsl/nir/nir_opt_cse.c
+++ b/src/glsl/nir/nir_opt_cse.c
@@ -139,12 +139,16 @@ dest_is_ssa(nir_dest *dest, void *data)
static bool
nir_instr_can_cse(nir_instr *instr)
{
+ /* We only handle SSA. */
+ if (!nir_foreach_dest(instr, dest_is_ssa, NULL) ||
+ !nir_foreach_src(instr, src_is_ssa, NULL))
+ return false;
+
switch (instr->type) {
case nir_instr_type_alu:
case nir_instr_type_load_const:
case nir_instr_type_phi:
- return nir_foreach_dest(instr, dest_is_ssa, NULL) &&
- nir_foreach_src(instr, src_is_ssa, NULL);
+ return true;
case nir_instr_type_tex:
return false; /* TODO */
case nir_instr_type_intrinsic:
More information about the mesa-commit
mailing list