RFR: 8332268: C2: Add missing optimizations for UDivI/L and UModI/L and unify the shared logic with the signed nodes [v8]

theoweidmannoracle duke at openjdk.org
Thu Nov 28 16:05:39 UTC 2024


On Thu, 28 Nov 2024 14:28:50 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> theoweidmannoracle has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   abs(MIN_INT) is not positive
>
> 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>();

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22061#discussion_r1862433331


More information about the hotspot-compiler-dev mailing list