This is a repost of the patches I posted yesterday, The main differences are I've fixed the kill emission for llvm to be correct, and I've fixed the nir opt pass to be cleaner, check for dependent phis and handle if (a) discard_if(b) cases. Dave.