Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl_codegen.c:
/* Compute the earliest and latest liveness for each variable. In the case that
- a variable is accessed inside of a loop, we promote its liveness to extend
- to at least the range of the entire loop. Note that we don't need to do this
- for anonymous nodes, since there's currently no way to use a node which was
- calculated in an earlier iteration of the loop. */
- to at least the range of the entire loop. We also need to do this for
- anonymous nodes, so that their temp register is protected from being
- overwritten by subsequent instructions before the next iteration. */
I want to nitpick this wording a bit. I think when I wrote the original code I was only thinking of nodes produced inside of a loop. That's still what I think of when I see this comment (or commit message), and I still think that doesn't actually make conceptual sense. Rather, what does make sense, and what this patch addresses is the case where a node produced before the loop is used inside the loop.