RFR: 8308504: C2: "malformed control flow" after JDK-8303466

Roland Westrelin roland at openjdk.org
Fri Jul 21 12:14:46 UTC 2023


I took that bug over from Emanuel because he's away:
https://github.com/openjdk/jdk/pull/14331

I tried adding a `CastII` to narrow the limit of the loop as I
suggested in a comment on the PR but I found that doesn't work in all
cases: if the type of the initial value for the loop variable is not
narrow enough, then the narrower type for the limit doesn't help
narrow the loop phi type.

What I propose instead is to add an assert predicate that catches when
the main loop is unreachable but the zero trip count doesn't constant
fold. For that to work, the order of predicates must be preserved when
they are copied or updated. I had to make some small changes to
guarantee that.

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

Commit messages:
 - fix and test

Changes: https://git.openjdk.org/jdk/pull/14973/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14973&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8308504
  Stats: 195 lines in 4 files changed: 154 ins; 16 del; 25 mod
  Patch: https://git.openjdk.org/jdk/pull/14973.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14973/head:pull/14973

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


More information about the hotspot-compiler-dev mailing list