8279837: C2: assert(is_Loop()) failed: invalid node class: Region #7029
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
In the test case, we are attempting to apply
iteration_split_impl()
to a loop head which is aRegionNode
and not aLoopNode
. We then fail with an assertion when attempting to cast it.This is quite an edge case.
build_loop_tree()
is initially adding aNeverBranch
to an infinite inner loop. Afterwards,beautify_loop()
makes progress on some other loop nest where the inner and outer loop share the same loop head. As a result,build_loop_tree()
is called again:jdk/src/hotspot/share/opto/loopnode.cpp
Lines 4184 to 4189 in 2bbeae3
Through
Root
->Halt
->CProj
->NeverBranch
, the infinite loop is now reachable and is built as child of_ltree_root
. However, theRegion
is not yet aLoop
node. This will only happen in the next iteration of loop opts whenbeautify_loop()
is called again. We then fail with the assertion assuming that loop tree head nodes are alwaysLoopNodes
. Some more details can be found in the comments of the test.The fix is straight forward to bail out of
iteration_split_impl()
for non-LoopNodes
. We already do a similar bailout in other optimizations like loop predication:jdk/src/hotspot/share/opto/loopPredicate.cpp
Lines 1427 to 1430 in 2bbeae3
Thanks,
Christian
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7029/head:pull/7029
$ git checkout pull/7029
Update a local copy of the PR:
$ git checkout pull/7029
$ git pull https://git.openjdk.java.net/jdk pull/7029/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7029
View PR using the GUI difftool:
$ git pr show -t 7029
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7029.diff