As previously mentioned it is possible to build a more complicated test that still can make copy-prop spinning after 1/1.
Consider the following sequence of instructions:
1 : A 2 : B = @1 3 : B 4 : A = @3 5 : @1.x
Current copy-prop would replace 5 so it points to @3 now:
1 : A 2 : B = @1 3 : B 4 : A = @3 5 : @3.x
But in the next iteration it would make it point back to @1, keeping it spinning infinitively.
So I improved the solution appending 2/3 and 3/3, and also added a stronger test in 3/3.
While 1/3 could be squashed into 3/3, I think it is good to keep it for documentation purposes.
is to index the instructions and don't replace the swizzle if the new load happens after the current load.
1/1 wasn't enough to solve all copy-propagation bugs I improved the solution in 2/3 and 3/3.
Now, the more obscure bug happens