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

theoweidmannoracle duke at openjdk.org
Mon Dec 2 13:38:42 UTC 2024


On Mon, 2 Dec 2024 10:05:58 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/divnode.cpp line 1156:
>> 
>>> 1154:   }
>>> 1155:   // Don't bother trying to transform a dead node
>>> 1156:   if (mod->in(0) && mod->in(0)->is_top()) {
>> 
>> Suggestion:
>> 
>>   if (mod->in(0) != nullptr && mod->in(0)->is_top()) {
>> 
>> 
>> https://github.com/openjdk/jdk/blob/master/doc/hotspot-style.md
>> `Do not use ints or pointers as (implicit) booleans with &&, ||, if, while. Instead, compare explicitly, i.e. if (x != 0) or if (ptr != nullptr), etc.`
>
> There are more instances in the code. I know you copied it, but when we touch code we make sure to adhere to the new rules ;)

It would be nice to have some automatic checks for this (like the check for extra whitespace). clang-tidy can perform this check automatically, for example.

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

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


More information about the hotspot-compiler-dev mailing list