RFR: 8332827: [REDO] C2: crash in compiled code because of dependency on removed range check CastIIs

Emanuel Peter epeter at openjdk.org
Wed Dec 11 07:54:44 UTC 2024


On Thu, 5 Dec 2024 09:33:43 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> The failures that caused the backout were due to a bug in:
> 
> `find_or_make_integer_cast()`
> 
> which caused the `_range_check_dependency` field's value of the
> existing cast node to not be set in the new cast node. I re-ran some
> testing with this fixed and current jdk repo and found that a few
> vectorization tests fail now because the patch pushes range check
> `CastII` nodes through `AddI`/`SubI`. To fix this, I delayed that
> transformation to after loop opts.

Hi Roland,
thanks for taking this on!

I heave a few first comments / questions.

src/hotspot/share/opto/castnode.cpp line 259:

> 257:   if (_range_check_dependency) {
> 258:     if (phase->C->post_loop_opts_phase()) {
> 259:       return this->in(1);

Does the removal of the CastII happen anywhere at all any more now?

src/hotspot/share/opto/compile.cpp line 3147:

> 3145:     DivModNode* divmod = DivModNode::make(n, bt, is_unsigned);
> 3146:     divmod->add_prec_from(n);
> 3147:     divmod->add_prec_from(d);

Can you explain why you added this?

src/hotspot/share/opto/compile.cpp line 3801:

> 3799: }
> 3800: 
> 3801: void Compile::remove_range_check_cast(CastIINode* cast) {

Why not make this a member function of `CastIINode`?

test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterRCCastIIEliminated.java line 26:

> 24: /**
> 25:  * @test
> 26:  * @bug 8324517

This bug number does not match the issue.

test/hotspot/jtreg/compiler/rangechecks/TestRangeCheckCastIISplitThruPhi.java line 31:

> 29:  * @run main/othervm -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestRangeCheckCastIISplitThruPhi
> 30:  *
> 31:  *

Formatting is a little off. And would it make sense to add a run without flags?

test/hotspot/jtreg/compiler/vectorization/TestVectorizationNegativeScale.java line 27:

> 25:  * @test
> 26:  * @bug 8332827
> 27:  * @summary [REDO] C2: crash in compiled code because of dependency on removed range check CastIIs

Can you say what happened with this test before your fix? Did it not vectorize? Or crash?

test/hotspot/jtreg/compiler/vectorization/TestVectorizationNegativeScale.java line 30:

> 28:  *
> 29:  * @library /test/lib /
> 30:  * @requires vm.compiler2.enabled

Is this required? The IR rules are only executed with C2 anyway.

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

PR Review: https://git.openjdk.org/jdk/pull/22568#pullrequestreview-2494539813
PR Review Comment: https://git.openjdk.org/jdk/pull/22568#discussion_r1879508946
PR Review Comment: https://git.openjdk.org/jdk/pull/22568#discussion_r1879511897
PR Review Comment: https://git.openjdk.org/jdk/pull/22568#discussion_r1879523078
PR Review Comment: https://git.openjdk.org/jdk/pull/22568#discussion_r1879485274
PR Review Comment: https://git.openjdk.org/jdk/pull/22568#discussion_r1879488024
PR Review Comment: https://git.openjdk.org/jdk/pull/22568#discussion_r1879490574
PR Review Comment: https://git.openjdk.org/jdk/pull/22568#discussion_r1879488584


More information about the hotspot-compiler-dev mailing list