RFR: 8349361: C2: RShiftL should support all applicable transformations that RShiftI does [v9]

Emanuel Peter epeter at openjdk.org
Mon Feb 24 15:46:09 UTC 2025


On Mon, 24 Feb 2025 15:27:53 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/mulnode.cpp line 1351:
>> 
>>> 1349:   const Node* and_node = in(1);
>>> 1350:   if (and_node->Opcode() == Op_And(bt) &&
>>> 1351:       (mask_t = phase->type(and_node->in(2))->isa_integer(bt)) &&
>> 
>> Is this an implicit null check?
>> 
>> Style guide:
>>> 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.
>
> Honestly, why not just split the `if` into 2 ifs.
> `const TypeInteger* mask_t;`
> That looks a little less than nice as well.

Oh it seams to me this whole code was not really changed, it just appears moved in the diff. Maybe you can rearrange the order so the diff looks smaller, and we don't have to argue about the (questionable) code style here ;)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23438#discussion_r1967898812


More information about the hotspot-compiler-dev mailing list