On Thu, 2 Jul 2026 14:27:10 GMT, Quan Anh Mai <[email protected]> wrote:

>> Yes, if it's not a constant, then we will have type `j.l.Object`. When later 
>> folding to `int.class`, the `LoadKlass` will be replaced by `null` and the 
>> null check makes sure the graph is folded correctly.
>
> Ah, I see the reason here, inside `LibraryCallKit::load_klass_from_mirror`, 
> we null-check the result we get from the load. This means that if we have a 
> constant `int.class`, the load will be a constant `null`, and the return 
> value is `top`. But this also means that `klass_node` has already been 
> null-checked, so the null-check we do right below seems redundant.

That's a good observation and also seems to be redundant in mainline. We could 
follow-up with an RFE there, what do you think?

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2569#discussion_r3514337177

Reply via email to