As a follow-up to D156451, add a test corresponding to the following
program, after running it through GVN:
void BeamFormWeights(int a[20000], int beam) { for (int i = 0; i < 10000; ++i) { if (i == beam) a[2 * i] = 0; else a[2 * i] = 1; } }
Sinking in this particular case is particularly challenging, and can
only be done by a GVN-aware sinking pass.
Please at least run this through SROA. The test is a weird mix of completely unoptimized IR plus a GVN replacement.