Skip to content

nir: Switch the indexing of block->live_in/out arrays.

Emma Anholt requested to merge anholt/mesa:nir-live-index into master

In nir-to-tgsi, I want to free temps storing SSA values when they go dead, and NIR liveness has most of the information I need. Hoever, when I reach the end of a block, I need to free whatever temps were in liveout which are dead at that point. If liveout is indexed by live_index, then I don't know the maximum live_index for iterating the live_out bitset, and I also don't have a way to map that index back to the def->index that my temps are stored under.

We can use the more typical def->index for these bitsets, which resolves both of those problems. The only cost is that ssa_undefs don't get merged into a single bit in the bitfield, but there are generally 1-4 of them in a shader and we don't track liveness for those anyway so splitting them apart is fine.

@jekstrand who had a related patch that he dropped from a series recently

Merge request reports