RFR: 8347459: C2: missing transformation for chain of shifts/multiplications by constants [v4]

Marc Chevalier duke at openjdk.org
Tue Feb 25 12:59:21 UTC 2025


On Fri, 21 Feb 2025 18:41:21 GMT, Jasmine Karthikeyan <jkarthikeyan at openjdk.org> wrote:

>> Marc Chevalier has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   comment
>
> src/hotspot/share/opto/mulnode.cpp line 1018:
> 
>> 1016: // constant, flatten the tree: (X+con1)<<con0 ==> X<<con0 + con1<<con0
>> 1017: //
>> 1018: // (X << con1) << con2 ==> X << (con1 + con2) (see collapseDoubleShiftLeft for details)
> 
> I think it would be better to move this comment where `collapseDoubleShiftLeft` is called in the Ideal function, and same for `LShiftLNode::Ideal`.

I think I can repeat the comment, but I think it should also stay here since otherwise, the comment at the head of the method is incomplete: it says it performs `(X+con1)<<con0 ==> X<<con0 + con1<<con0` which is not complete.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23728#discussion_r1969730694


More information about the hotspot-compiler-dev mailing list