Mesa (master): nir: Fix load_const comparisons for CSE.
Eric Anholt
anholt at kemper.freedesktop.org
Wed Feb 11 19:54:17 UTC 2015
Module: Mesa
Branch: master
Commit: 2919bdf466295bc3fbf6f6e796ef8d301404d3d9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2919bdf466295bc3fbf6f6e796ef8d301404d3d9
Author: Eric Anholt <eric at anholt.net>
Date: Fri Feb 6 17:16:29 2015 -0800
nir: Fix load_const comparisons for CSE.
We want the size of a float per component, not the size of a whole vec4.
NIR instructions on i965:
total instructions in shared programs: 1261937 -> 1261929 (-0.00%)
instructions in affected programs: 114 -> 106 (-7.02%)
Looking at one of these examples (tesseract), it's from vec4 load_consts
for a MRT solid fill, which do get CSEed now that we don't memcmp off the
end of the const value and into the SSA def. For the 1-component loads
that are common in i965, we were only memcmping off into the rest of the
usually zero-filled const_value.
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
---
src/glsl/nir/nir_opt_cse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/glsl/nir/nir_opt_cse.c b/src/glsl/nir/nir_opt_cse.c
index b3e9c0d..9b38320 100644
--- a/src/glsl/nir/nir_opt_cse.c
+++ b/src/glsl/nir/nir_opt_cse.c
@@ -90,7 +90,7 @@ nir_instrs_equal(nir_instr *instr1, nir_instr *instr2)
return false;
return memcmp(load1->value.f, load2->value.f,
- load1->def.num_components * sizeof load2->value.f) == 0;
+ load1->def.num_components * sizeof(*load2->value.f)) == 0;
}
case nir_instr_type_phi: {
nir_phi_instr *phi1 = nir_instr_as_phi(instr1);
More information about the mesa-commit
mailing list