RFR: 8365844: RISC-V: TestBadFormat.java fails when running without RVV

Dingli Zhang dzhang at openjdk.org
Thu Aug 21 06:13:52 UTC 2025


On Thu, 21 Aug 2025 05:54:59 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>>> @eme64 Thanks for the review! I have another method to change the IR matching rules for riscv64 so that other tests can be run without RVV:
>>> 
>>> ```diff
>>> diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestBadFormat.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestBadFormat.java
>>> index ac8867f3985..2bf14bdfa5a 100644
>>> --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestBadFormat.java
>>> +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestBadFormat.java
>>> @@ -1124,9 +1124,21 @@ public void wrongCountString() {}
>>>  
>>>      @Test
>>>      @FailCount(8)
>>> -    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0"})
>>> -    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_MAX, "> 0"}) // valid
>>> -    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_ANY, "> 0"}) // valid
>>> +    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0"},
>>> +        applyIfPlatform = {"riscv64", "false"})
>>> +    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0"},
>>> +        applyIfPlatform = {"riscv64", "true"},
>>> +        applyIfCPUFeature = {"rvv", "true"})
>>> +    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_MAX, "> 0"},
>>> +        applyIfPlatform = {"riscv64", "false"}) // valid
>>> +    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_MAX, "> 0"},
>>> +        applyIfPlatform = {"riscv64", "true"},
>>> +        applyIfCPUFeature = {"rvv", "true"})
>>> +    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_ANY, "> 0"},
>>> +        applyIfPlatform = {"riscv64", "false"}) // valid
>>> +    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_ANY, "> 0"},
>>> +        applyIfPlatform = {"riscv64", "true"},
>>> +        applyIfCPUFeature = {"rvv", "true"})
>>>      @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "", "> 0"})
>>>      @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "xxx", "> 0"})
>>>      @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min()", "> 0"})
>>> ```
>> 
>> Hi @eme64 What do you think?
>
> From the log you provided, it looks like only these two rules for `badVectorNodeSize()`
> 
>     @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0"})
>     @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_MAX, "> 0"}) 
> ``` 
> result in a format violation which was not unexpected on other platforms (they expect rule 1-3 to pass):
> 
>  - VMInfo: MaxVectorSize is not larger than zero for IR rule 1 at public int[] ir_framework.tests.BadIRAnnotationsAfterTestVM.badVectorNodeSize().
>  - VMInfo: MaxVectorSize is not larger than zero for IR rule 2 at public int[] ir_framework.tests.BadIRAnnotationsAfterTestVM.badVectorNodeSize().
> 
> It looks like `MaxVectorSize` is 0 when run without RVV on riscv. Can you try and just add
> 
> applyIf = {"MaxVectorSize", ">0"}
> 
> to both of these rules instead of the platform/CPU specific conditions? That would be less restrictive and also applies for other platforms that have `MaxVectorSize` set to 0 by default.

@chhagedorn Thanks for your review!
This is indeed a better solution. I will try it and update later.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26855#discussion_r2289953622


More information about the hotspot-compiler-dev mailing list