RFR: 8305189: C2 failed "assert(_outcnt==1) failed: not unique"
Christian Hagedorn
chagedorn at openjdk.org
Wed May 10 16:13:28 UTC 2023
On Wed, 10 May 2023 11:27:06 GMT, Roland Westrelin <roland at openjdk.org> wrote:
> pre/main/post loops are created for an inner loop of a loop nest but
> assert predicates cause the main and post loops to be removed. The
> OpaqueZeroTripGuard nodes for the loops are not removed: there's no
> logic to trigger removal of the opaque nodes once the loops are no
> longer there. With the inner loops gone, the outer loop becomes
> candidate for optimizations and is unrolled which causes the zero trip
> guards of the now removed loops to be duplicated and the opaque nodes
> to have more than one use.
>
> The fix I propose is, using logic similar to
> `PhaseIdealLoop::eliminate_useless_predicates()`, to check during loop
> opts if every OpaqueZeroTripGuard node guards a loop and if not,
> remove it.
That looks reasonable.
src/hotspot/share/opto/loopnode.cpp line 6180:
> 6178:
> 6179: if (!_verify_only && n->Opcode() == Op_OpaqueZeroTripGuard) {
> 6180: _zero_trip_guard_opaque_nodes.push(n);
That's a good idea to collect them newly here for each loop opts pass.
src/hotspot/share/opto/opaquenode.cpp line 58:
> 56: }
> 57:
> 58: CountedLoopNode* OpaqueZeroTripGuardNode::guarded_loop() const {
Could be guarded with `ifdef ASSERT` since you are only using it for an assertion.
-------------
Marked as reviewed by chagedorn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13901#pullrequestreview-1420924277
PR Review Comment: https://git.openjdk.org/jdk/pull/13901#discussion_r1190130323
PR Review Comment: https://git.openjdk.org/jdk/pull/13901#discussion_r1190092689
More information about the hotspot-compiler-dev
mailing list