RFR: 8341834: C2 compilation fails with "bad AD file" due to Replicate

Emanuel Peter epeter at openjdk.org
Wed Oct 23 11:55:04 UTC 2024


On Wed, 23 Oct 2024 08:30:15 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> Superword creates a `Replicate` node at a `ConvL2I` node and uses the
> type of the result of the `ConvL2I` to pick the type of the
> `Replicate` instead of the type of the input to the `ConvL2I`.

Hi Roland,

Isn't it a little strange that we have a Replicate before a ConvL2I pack? That means that the ConvL2I did not common, even though they have the same inputs. I guess that is due to the `type` not being identical - a rather rare case.


 Pack: 8
    0:  739  ConvL2I  === _ 742  [[ 738 ]]  #int:2..99:www !orig=612,467,407,[138],[156] !jvms: Test4::test @ bci:41 (line 11)
    1:  741  ConvL2I  === _ 742  [[ 740 ]]  #int:2..198:www !orig=613,468,440
 Pack: 9
    0:  755  ConvL2I  === _ 756  [[ 738 ]]  #int:2..109:www !orig=594,458,[399],137 !jvms: Test4::test @ bci:37 (line 10)
    1:  754  ConvL2I  === _ 756  [[ 740 ]]  #int:2..208:www !orig=591,514


I played around with the test case as well, reducing it further:

`./java -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,Test4::test -Xcomp -XX:+TraceSuperWord -XX:+TraceNewVectors -XX:UseAVX=2 Test4.java`


public class Test4 {
    public static long val = 0;

    public static void test(int x) {
        x = Math.max(0, Math.min(10, x)); // type 0..10
        short a[] = new short[500];

        for (long l = 0; l < 100; l++) {
            val = l + x; // store seems required, hmm
            int y = (int)val;
            int z = (int)l; // this becomes multiple ConvL2I
            a[z] = (short)(z - y);
        }
    }

    public static void main(String[] args) {
        Math.min(0, 1);
        Math.max(0, 1);
        test(0);
    }
}

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

PR Comment: https://git.openjdk.org/jdk/pull/21660#issuecomment-2431873793


More information about the hotspot-compiler-dev mailing list