Skip to content

nir: Eliminate dead writes to shared memory at the end of the program

Kenneth Graunke requested to merge kwg/mesa:nir-dead-end-shared into main

If the program writes to shared variables after all reads, in the last block of the program, no one will ever read the value we write. We can just eliminate these dead writes.

This doesn't help very often, but when it does, it can be significant. fossil-db results on Battlemage (Arc B570):

   Totals from 49 (0.01% of 574410) affected shaders:
   Instrs: 33850 -> 33682 (-0.50%)
   Send messages: 2777 -> 2659 (-4.25%)
   Cycle count: 1584214 -> 1577188 (-0.44%); split: -0.86%, +0.41%
   Max live registers: 5841 -> 5797 (-0.75%)

Helped shaders are in three Unreal Engine 4 based titles as well as Red Dead Redemption 2.

Merge request reports

Loading