Skip to content

nir/peephole_select: Allow load_preamble

Alyssa Rosenzweig requested to merge alyssa/mesa:asahi/peephole-preamble into main

load_preamble is intended to be almost free (costing at most a move), and it does not have special bounds checking requirement, so it's ok to select with it. With this, drivers that use nir_opt_preamble together with a late call to peephole_select can optimize sequences like:

   if (x) {
      <uniform-on-uniform calculation>
   } else {
      <different uniform-on-uniform calculation>
   }

to simply

   bcsel(x, <uniform register 0>, <uniform register 1>)

rather than emitting needless control flow / branching over some moves.

Edited by Alyssa Rosenzweig

Merge request reports