RFR: 8332268: C2: Add missing optimizations for UDivI/L and UModI/L and unify the shared logic with the signed nodes [v8]
Quan Anh Mai
qamai at openjdk.org
Thu Nov 28 16:21:18 UTC 2024
On Thu, 28 Nov 2024 16:01:52 GMT, theoweidmannoracle <duke at openjdk.org> wrote:
>> src/hotspot/share/opto/divnode.cpp line 488:
>>
>>> 486:
>>> 487: const Type* t = phase->type(div->in(2));
>>> 488: const TypeClass* tl = t->cast<TypeClass>();
>>
>> I believe `is_int()` will assert when `t` is not a `TypeInt`, what you want here is a `try_cast` that calls `isa_int()` instead.
>
> If I understand correctly, you are referring to the fact that `t` might be top, which is not correctly handled here, right? If that is what you mean, I think I will fix it by handling this case separately like in unsigned_mod_ideal blow because `t` should only ever be TypeClass (i.e. long or int) or Top. Or am I missing something?
>
>
> const Type* t = phase->type(mod->in(2));
> if (t == Type::TOP) {
> return nullptr;
> }
> const TypeClass* ti = t->cast<TypeClass>();
Yes, I saw you checking for `nullptr` in the following line and thought you confused `is_int()` with `isa_int()`, the former cannot return a `nullptr`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22061#discussion_r1862450302
More information about the hotspot-compiler-dev
mailing list