RFR: 8351844: C2 x64 AVX2 vpminmax assertion failure with equivalent inputs

Aleksey Shipilev shade at openjdk.org
Wed Dec 3 11:15:44 UTC 2025


On Tue, 2 Dec 2025 11:10:08 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

> Bug fix PR fixes an incorrect register equivalence in macro assembler. MaxV/MinV IR with equivalent inputs should ideally be removed from ideal graph before reaching to macro assembler. [JDK-8372797](https://bugs.openjdk.org/browse/JDK-8372797) is filed to add relevant identity transformations.
> 
> Best Regards,
> Jatin

The product fix looks reasonable. The asserts need to verify that write to `dst` does not yet destroy either of `src`-s. We don't need to check that `src`-s are actually distinct.

I have test comments/questions:

test/hotspot/jtreg/compiler/vectorapi/TestVectorMinMaxSameInputs.java line 44:

> 42: 
> 43:     public static void main(String[] args) {
> 44:         TestFramework.runWithFlags("--add-modules=jdk.incubator.vector", "-ea", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:UseAVX=2");

I understand `-XX:UseAVX=2` is here to hit the path where the assert is on. But for a generic test like this, it would seem unwise to limit the test configuration only to AVX=2. I would expect we instead run the tests with `TEST_VM_OPTS=-XX:UseAVX=2` to confirm they work with AVX=2 even on AVX-512 machines.

test/hotspot/jtreg/compiler/vectorapi/TestVectorMinMaxSameInputs.java line 58:

> 56: 
> 57:     @Test
> 58:     @IR(counts={IRNode.MAX_VL, "1"})

In other tests, I see we are actually checking for CPU feature flags before assuming these nodes are present:


    @Test
    @IR(applyIfCPUFeatureOr = { "sse4.1", "true" , "asimd" , "true", "rvv", "true"},
        counts = { IRNode.MAX_VL, "> 0" })


So this test would probably fail on some older hardware and/or with some configuration options?

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

PR Review: https://git.openjdk.org/jdk/pull/28600#pullrequestreview-3534540911
PR Review Comment: https://git.openjdk.org/jdk/pull/28600#discussion_r2584692296
PR Review Comment: https://git.openjdk.org/jdk/pull/28600#discussion_r2584688358


More information about the hotspot-compiler-dev mailing list