RFR: 8298935: fix cyclic dependency bug in create_pack logic in SuperWord::find_adjacent_refs

Emanuel Peter epeter at openjdk.org
Mon Mar 6 10:45:53 UTC 2023


On Mon, 6 Mar 2023 04:48:04 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

> I did some additional testing and found that following case which does not carry any true dependency no longer vectorizes with default options (-AlignVector).

I think this was never supposed to vectorize, but just slipped through the cracks as a "happy accident". But the "bad accident" case also slipped through, as shown in my PR description at the beginning:

 static void test2(int[] dataI, float[] dataF) { 
     for (int i = 0; i < RANGE - 2; i++) { 
         // dataI has cyclid dependency of distance 2, cannot vectorize 
         int v = dataI[i]; 
         dataI[i + 2] = v; 
         dataF[i] = v; // let's not get confused by another type 
     } 
 } 


The reason why it should not vectorize: loads / stores of the same `velt_type` (memory slice) do not pass `memory_alignment == 0`, which is crucial to ensure that the `packs` are `independent` (and not just the `pairs`).
CompileCommand `Vectorize` bypasses this behaviour, as just explained here https://github.com/openjdk/jdk/pull/12350#discussion_r1126206603.

-------------

PR: https://git.openjdk.org/jdk/pull/12350


More information about the hotspot-compiler-dev mailing list