[jdk19] RFR: 8289127: Apache Lucene triggers: DEBUG MESSAGE: duplicated predicate failed which is impossible

Roland Westrelin roland at openjdk.org
Fri Jul 15 12:39:48 UTC 2022


Loop predication adds a skeleton predicate for a range check that computes:

(AddL (ConvI2L (MulI (CastII (AddI (OpaqueLoopInit 0) (SubI (OpaqueLoopStride ..) 1))) 7))  ..)

later transformed into:

(AddL (SubL (ConvI2L (LShiftI (CastII (AddI (OpaqueLoopInit 0) (OpaqueLoopStride ..))) 3)) (AddL (ConvI2L (CastII (AddI (OpaqueLoopInit 0) (OpaqueLoopStride ..)))) -1)) ..)

When pre/main/post loops are added, this expression is copied (above
the main loop) and updated. The logic performing the copy relies on
skeleton_follow_inputs() to find the OpaqueLoopInit nodes and clone it
with an updated initial value. Note there are 2 OpaqueLoopInit nodes
to update in the transformed expression. But because
skeleton_follow_inputs() doesn't include LShiftI only one of the
OpaqueLoopInit node is cloned with an updated initial value.

After loop opts are over, the OpaqueLoopInit nodes are replaced by
their input which result in this particular case in a predicate that
always fails.

The fix is to fix skeleton_follow_inputs() to include LShiftI. I also
added verification code to catch similar issues in the future.

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

Commit messages:
 - assert
 - test
 - fix

Changes: https://git.openjdk.org/jdk19/pull/143/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk19&pr=143&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8289127
  Stats: 86 lines in 2 files changed: 83 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk19/pull/143.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/143/head:pull/143

PR: https://git.openjdk.org/jdk19/pull/143


More information about the hotspot-compiler-dev mailing list