Mesa (master): nir/instr_set: remove unnecessary check in nir_instrs_equal ()

Connor Abbott cwabbott0 at kemper.freedesktop.org
Fri Oct 9 14:22:42 UTC 2015


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

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Thu Sep 24 02:18:07 2015 -0400

nir/instr_set: remove unnecessary check in nir_instrs_equal()

This was originally added to nir_instrs_equal() instead of
nir_instr_can_cse() incorrectly, but this was fixed when moving to the
instruction set API (as it had to be, otherwise hashing wouldn't work).
Now, this is dead code since instr_can_rewrite() will only return true
for texture instructions that use an index, so we can turn the check into
an assert. This also means that now nir_instrs_equal(instr, instr) will
always return true unless it assert-fails.

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
Signed-off-by: Connor Abbott <cwabbott0 at gmail.com>

---

 src/glsl/nir/nir_instr_set.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/glsl/nir/nir_instr_set.c b/src/glsl/nir/nir_instr_set.c
index 7886003..d3f939f 100644
--- a/src/glsl/nir/nir_instr_set.c
+++ b/src/glsl/nir/nir_instr_set.c
@@ -311,8 +311,7 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2)
       }
 
       /* Don't support un-lowered sampler derefs currently. */
-      if (tex1->sampler || tex2->sampler)
-         return false;
+      assert(!tex1->sampler && !tex2->sampler);
 
       return true;
    }




More information about the mesa-commit mailing list