RFR: 8348411: C2: Remove the control input of LoadKlassNode and LoadNKlassNode [v2]

Vladimir Ivanov vlivanov at openjdk.org
Tue Jan 28 21:01:46 UTC 2025


On Thu, 23 Jan 2025 19:08:25 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Hi,
>> 
>> This patch removes the control input of `LoadKlassNode` and `LoadNKlassNode`. They can only have a control input if created inside `Parse::array_store_check()`, the reason given is:
>> 
>>     // We are allowed to use the constant type only if cast succeeded
>> 
>> But this seems incorrect, the load from the constant type can be done regardless, and it will be constant-folded. This patch only makes that more formal and cleanup `LoadKlassNode::can_remove_control`.
>> 
>> Please take a look and leave your reviews, thanks a lot.
>
> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove always_see_exact_class

src/hotspot/share/opto/parseHelper.cpp line 168:

> 166:   // succeeds.
> 167:   if (MonomorphicArrayCheck && !too_many_traps(Deoptimization::Reason_array_check) && !tak->klass_is_exact()
> 168:       && tak != TypeInstKlassPtr::OBJECT) {

I'd also turn `tak != TypeInstKlassPtr::OBJECT` into `tak->isa_aryklassptr()` to stress the intention.
(Please, keep the original formatting here.)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23274#discussion_r1932847737


More information about the graal-dev mailing list