aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_opt_remove_phis.c
Commit message (Collapse)AuthorAgeFilesLines
* nir: move to compiler/Emil Velikov2016-01-261-130/+0
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Jose Fonseca <[email protected]>
* nir: Get rid of function overloadsJason Ekstrand2015-12-281-3/+3
| | | | | | | | | | | | | | | | | When Connor originally drafted NIR, he copied the same function+overload system that GLSL IR had with a few names changed. However, this double-indirection is not really needed and has only served to confuse people. Instead, let's just have functions which may not have unique names and may or may not have an implementation. If someone wants to do overload resolving, they can hav a hash table based function+overload system in the overload resolving pass. There's no good reason to keep it in core NIR. Reviewed-by: Connor Abbott <[email protected]> Acked-by: Kenneth Graunke <[email protected]> ir3 bits are Reviewed-by: Rob Clark <[email protected]>
* nir: Properly invalidate metadata in nir_opt_remove_phis().Kenneth Graunke2015-11-031-0/+5
| | | | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]> Cc: [email protected]
* nir/remove_phis: handle trivial back-edgesConnor Abbott2015-10-021-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some loops may have phi nodes that look like: foo = ... loop { bar = phi(foo, bar) ... } in which case we can remove the phi node and replace all uses of 'bar' with 'foo'. In particular, there are some L4D2 vertex shaders with loops that, after optimization, look like: /* succs: block_1 */ loop { block block_1: /* preds: block_0 block_4 */ vec1 ssa_2195 = phi block_0: ssa_2136, block_4: ssa_994 vec1 ssa_7321 = phi block_0: ssa_8195, block_4: ssa_7321 vec1 ssa_7324 = phi block_0: ssa_8198, block_4: ssa_7324 vec1 ssa_7327 = phi block_0: ssa_8174, block_4: ssa_7327 vec1 ssa_8139 = intrinsic load_uniform () () (232) vec1 ssa_588 = ige ssa_2195, ssa_8139 /* succs: block_2 block_3 */ if ssa_588 { block block_2: /* preds: block_1 */ break /* succs: block_5 */ } else { block block_3: /* preds: block_1 */ /* succs: block_4 */ } block block_4: /* preds: block_3 */ vec1 ssa_994 = iadd ssa_2195, ssa_2150 /* succs: block_1 */ } where after removing the second, third, and fourth phi nodes, the loop becomes entirely dead, and this patch will cause the loop to be deleted entirely. No piglit regressions. Shader-db results on bdw: instructions in affected programs: 5824 -> 5664 (-2.75%) total loops in shared programs: 2234 -> 2202 (-1.43%) helped: 32 Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Connor Abbott <[email protected]>
* nir: Remove the mem_ctx parameter from ssa_def_rewrite_usesJason Ekstrand2015-09-111-4/+1
| | | | Reviewed-by: Thomas Helland <[email protected]>
* nir: add an optimization to remove useless phi nodesConnor Abbott2015-02-031-0/+109
This removes phi nodes whose sources all point to the same thing. Shader-db results: total NIR instructions in shared programs: 2045293 -> 2041209 (-0.20%) NIR instructions in affected programs: 126564 -> 122480 (-3.23%) helped: 615 HURT: 0 total FS instructions in shared programs: 4321840 -> 4320392 (-0.03%) FS instructions in affected programs: 24622 -> 23174 (-5.88%) helped: 138 HURT: 0 Reviewed-by: Jason Ekstrand <[email protected]> Tested-by: Jason Ekstrand <[email protected]> Signed-off-by: Connor Abbott <[email protected]>