On Wed, 28 Jan 2026 16:02:56 GMT, Damon Fenacci <[email protected]> wrote:
>> src/hotspot/share/opto/opaquenode.hpp line 150:
>>
>>> 148: bool _positive;
>>> 149: public:
>>> 150: OpaqueCheckNode(Compile* C, Node* tst, bool positive) :
>>> Node(nullptr, tst), _positive(positive) {
>>
>> `tst` is probably almost always a `BoolNode`. I'm wondering if it could also
>> be a constant because we already folded the `BoolNode`? But then it's
>> probably also useless to create the opaque node in the first place.
>
> Hmmm... I find it hard to totally exclude a constant (e.g. if its inputs are
> constant...?). In that case we could skip all the opaque business (I guess in
> the few places where new `OpaqueConstantBool` nodes are created). On the
> other hand the opaque node should only really delay the folding... 🤔
I think folding is fine since we implement `Value()` to take the input's
`Value()`. My understanding is that we insert an additional check that is
actually not needed because we already checked it in Java code. So, it should
be true at that point but C2 does not know that. We still insert the check in
order to make sure to also fold control away if data is dying. Once we know
that data will not die anymore, we can remove the useless check again.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2745545348