On Mon Dec 12 21:53:50 2022 +0000, Francisco Casas wrote:
Hmm, good point, this could indeed be separated from copy-prop, as part of the `while(progress)` loop. I think that this process is very related to copy-prop though, since, strictly speaking, it doesn't combine swizzles, but instead makes swizzle nodes that reference other swizzles to directly reference the source of the value. e.g. if we have multiple swizzles:
b = a.xz; c = b.yy;
what this does is keeping the same number of swizzles but it lowers 'c' so that it directly references the first non-swizzle node (`a` in this case):
b = a.xz; c = a.zz;
I think `swizzle_propagation` could be a good name for this pass, but I am not totally sure.
Sure, but a separate pass would also deal with "a.xz.yy". Granted, probably nobody would ever write that intentionally (well, maybe with macros it's plausible, though?)