RFR: 8307927: C2: "malformed control flow" with irreducible loop [v2]

Roland Westrelin roland at openjdk.org
Thu Jun 29 07:49:55 UTC 2023


> The test contains a loop nest with 2 loops. The outer loop is an
> irreducible loop. The safepoint for that loop is also in the inner
> loop. Because `IdealLoopTree::check_safepts()` ignores irreducible
> loops, that safepoint is not marked as being required and is
> eliminated from the inner loop. The inner loop is then optimized out
> and the outer loop becomes an infinite loop with no safepoint (a
> single node loop). That, in turn, causes the loop to be eliminated
> because it has not use and the assert fires.
> 
> The fix I propose is to make `IdealLoopTree::check_safepts()` work
> with irreducible loops. I think
> `IdealLoopTree::allpaths_check_safepts()` can be used for that. When
> working on this I wondered if that method could be called with a loop
> whose head has more than 3 inputs. I couldn't write a test case with
> an irreducible loop whose head had more than 3 inputs but I added an
> assert in the method and ran some testing. That assert fired so I also
> propose to tweak the method so it's robust in that case.

Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - review
 - Merge branch 'master' into JDK-8307927
 - test

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/14522/files
  - new: https://git.openjdk.org/jdk/pull/14522/files/3bb72120..bbf4d581

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=14522&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14522&range=00-01

  Stats: 65999 lines in 1460 files changed: 44160 ins; 15886 del; 5953 mod
  Patch: https://git.openjdk.org/jdk/pull/14522.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14522/head:pull/14522

PR: https://git.openjdk.org/jdk/pull/14522


More information about the hotspot-compiler-dev mailing list