RFR: 8286625: C2 fails with assert(!n->is_Store() && !n->is_LoadStore()) failed: no node with a side effect

Roland Westrelin roland at openjdk.java.net
Thu Jun 2 15:50:55 UTC 2022


It's another case where because of overunrolling, the main loop is
never executed but not optimized out and the type of some
CastII/ConvI2L for a range check conflicts with the type of its input
resulting in a broken graph for the main loop.

This is supposed to have been solved by skeleton predicates. There's
indeed a predicate that should catch that the loop is unreachable but
it doesn't constant fold. The shape of the predicate is:

(CmpUL (SubL 15 (ConvI2L (AddI (CastII int:>=1) 15) minint..maxint)) 16)

I propose adding a CastII, that is in this case:

(CmpUL (SubL 15 (ConvI2L (CastII (AddI (CastII int:>=1) 15) 0..max-1) minint..maxint)) 16)

The justification for the CastII is that the skeleton predicate is a
predicate for a specific iteration of the loop. That iteration of the
loop must be in the range of the iv Phi.

With the extra CastII, the AddI can be pushed through the CastII and
ConvI2L and the check constant folds. Actually, with the extra CastII,
the predicate is not implemented with a CmpUL but a CmpU because the
code can tell there's no risk of overflow (I did force the use of
CmpUL as an experiment and the CmpUL does constant fold)

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

Commit messages:
 - test & fix

Changes: https://git.openjdk.java.net/jdk/pull/8996/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8996&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8286625
  Stats: 63 lines in 3 files changed: 62 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8996.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8996/head:pull/8996

PR: https://git.openjdk.java.net/jdk/pull/8996


More information about the hotspot-compiler-dev mailing list