This replaces an O(n^2) algorithm with an O(n) one, while allowing us to import most of the infrastructure required for GVN. The idea is to walk the dominance tree depth-first, similar when converting to SSA, and remove the instructions from the set when we're done visiting the sub-tree of the dominance tree so that the only instructions in the set are the instructions that dominate the current block.
No piglit regressions. No shader-db changes.
Compilation time for full shader-db:
Difference at 95.0% confidence-35.826 +/- 2.16018-6.2852% +/- 0.378975% (Student's t, pooled s = 3.37504)
v2:- rebase on start_block removal- remove useless state struct- change commit message
e8308d0 nir/cse: use the instruction set API
src/glsl/nir/nir_opt_cse.c | 138 ++++++++------------------------------------
1 file changed, 23 insertions(+), 115 deletions(-)
Upstream: cgit.freedesktop.org