Jason Ekstrand <ja...@jlekstrand.net> writes: > On Wed, Aug 12, 2015 at 11:55 AM, Eric Anholt <e...@anholt.net> wrote: >> NIR instruction count results on i965: >> total instructions in shared programs: 1261954 -> 1261937 (-0.00%) >> instructions in affected programs: 455 -> 438 (-3.74%) >> >> One in yofrankie, two in tropics. Apparently i965 had also optimized all >> of these out anyway. >> >> Reviewed-by: Kenneth Graunke <kenn...@whitecape.org> >> --- >> src/glsl/nir/nir_opt_cse.c | 43 +++++++++++++++++++++++++++++++++++++++---- >> 1 file changed, 39 insertions(+), 4 deletions(-) >> >> diff --git a/src/glsl/nir/nir_opt_cse.c b/src/glsl/nir/nir_opt_cse.c >> index 553906e..864795c 100644 >> --- a/src/glsl/nir/nir_opt_cse.c >> +++ b/src/glsl/nir/nir_opt_cse.c >> @@ -86,8 +86,41 @@ nir_instrs_equal(nir_instr *instr1, nir_instr *instr2) >> } >> return true; >> } >> - case nir_instr_type_tex: >> - return false; >> + case nir_instr_type_tex: { >> + nir_tex_instr *tex1 = nir_instr_as_tex(instr1); >> + nir_tex_instr *tex2 = nir_instr_as_tex(instr2); >> + >> + if (tex1->op != tex2->op) >> + return false; >> + >> + if (tex1->num_srcs != tex2->num_srcs) >> + return false; >> + for (unsigned i = 0; i < tex1->num_srcs; i++) { >> + if (tex1->src[i].src_type != tex2->src[i].src_type || >> + !nir_srcs_equal(tex1->src[i].src, tex2->src[i].src)) { >> + return false; > > We should probably loop over both arrays of sources and match by > source type instead of assuming that they are always in the same > order. They *probably* are, but you can pretty easily get cases where > they aren't. > > Otherwise, this looks fine to me.
What circumstance would produce arrays in different order? I can't imagine one, so conservative seems appropriate to me.
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev