[lworld] RFR: 8374116: [lworld] TestIntrinsics::test82 fails post JDK-8372634

Marc Chevalier mchevalier at openjdk.org
Tue Jan 13 10:24:40 UTC 2026


Before [JDK-8372634](https://bugs.openjdk.org/browse/JDK-8372634) in `Parse::sharpen_type_after_if`, we had
https://github.com/openjdk/jdk/blob/4e9525ef3619b02e905f16b89261b82c70830f3a/src/hotspot/share/opto/parse2.cpp#L1727-L1733
where `static Node* extract_obj_from_klass_load(PhaseGVN* gvn, Node* n)` can fail
https://github.com/openjdk/jdk/blob/4e9525ef3619b02e905f16b89261b82c70830f3a/src/hotspot/share/opto/parse2.cpp#L1695-L1708
if `val` is not a `LoadKlass` (or narrow version of it). In this case, `obj` would be `nullptr` and then nothing is done.

Now, we have
https://github.com/openjdk/jdk/blob/f2e56e4c18080616e8ef275a3d9c1da824efda26/src/hotspot/share/opto/parse2.cpp#L1805-L1807
that can take this branch
https://github.com/openjdk/jdk/blob/f2e56e4c18080616e8ef275a3d9c1da824efda26/src/hotspot/share/opto/parse2.cpp#L1734-L1741
where `extract_obj_from_klass_load` is unchanged, and can still fail. Yet, we have an `assert` now. That seems slightly fishy, but except in the case at hand, it doesn't mean to fire, so... it might be ok? Otherwise, replacing the return with `return (*obj) != nullptr;` would work.

But in the case we have, there isn't a `Bool(CmpP(LoadKlass(obj._klass), ConP(Foo.klass)), [eq])` as written in the comment, but instead a

Bool(FlatArrayCheck(Proj[mem](...), ConP), [eq])

This happens because `FlatArrayCheckNode` is a derived class from `CmpNode`. Yet, it doesn't work like a normal compare node: it's not necessarily binary, but mostly, having a constant operand doesn't allow to refine the other. So I suggest we don't even try `sharpen_type_after_if` in this case.


Thanks,
Marc

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

Commit messages:
 - Don't sharpen types for FlarArrayCheck

Changes: https://git.openjdk.org/valhalla/pull/1893/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1893&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8374116
  Stats: 7 lines in 2 files changed: 5 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/valhalla/pull/1893.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1893/head:pull/1893

PR: https://git.openjdk.org/valhalla/pull/1893


More information about the valhalla-dev mailing list