nir/vars_to_ssa: Use the new nir_phi_builder helper
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 13 Feb 2016 05:48:26 +0000 (21:48 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 24 Mar 2016 22:20:44 +0000 (15:20 -0700)
commitea98d415e42b7a97b8c9f37eb2e0e0f6ad98d14e
treeef56089dfc17b0d086912ff745c2f34c8376da62
parent42ddfc611f84297abeadf74be424387b127f7567
nir/vars_to_ssa: Use the new nir_phi_builder helper

The efficiency should be approximately the same.  We do a little more work
per phi node because we have to sort the predecessors.  However, we no
longer have to walk the blocks a second time to pop things off the stack.
The bigger advantage, however, is that we can now re-use the phi placement
and per-block SSA value tracking in other passes.

As a side-benifit, the phi builder actually handles unreachable blocks
correctly.  The original vars_to_ssa code, because of the way it iterated
the blocks and added phi sources, didn't add sources corresponding to
predecessors of unreachable blocks.  The new strategy employed by the phi
builder creates a phi source for each predecessor and should correctly
handle unreachable blocks by setting those sources to SSA undefs.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/compiler/nir/nir_lower_vars_to_ssa.c