Skip to content

vkd3d-shader/hlsl: Fix infinite loops when applying copy-prop to swizzles.

Francisco Casas requested to merge fcasas/vkd3d:copyprop-fix into master

Current copy-prop of swizzle instructions can result in infinite loops, as with the included test before this commit.

Consider the following sequence of instructions where a load is stored in the same variable it loads:

1 : A
2 : A = @1
3 : @1.x

In this case @3 would call copy_propagation_get_value() on A.x and would get @1, without detecting that that is indeed the same node it is already using as swizzle->value. So it would return true, keeping copy-prop spinning.

To avoid this, it is check that the replacement instruction is not the same as the swizzle->load instruction.


This was discovered when trying to compile shaders from Bug 19499.

Merge request reports

Loading