Skip to content

microsoft/compiler: Don't separate phis while inserting upcasts

Jesse Natalie requested to merge jenatali/mesa:affinity-photo-phis into master

Attempting to compile some kernels from Affinity Photo, we produced DXIL that refused to sign/validate, because we separated phis. See #4414 (closed).

The fix is to ensure that if the SSA source we're casting came from a phi, make sure the instruction we're inserting comes after all of the phis, instead of just the current instruction.

/cc @jekstrand, since this feels like there would be a cursor helper for it if this pattern is normal, so I suspect I'm doing something wrong. Maybe there's just not much lowering that works on phi sources, where the instructions need to be in the source block, instead of just before the current instruction?

Merge request reports