RFR: 8325495: C2: implement optimization for series of Add of unique value [v2]
Kangcheng Xu
kxu at openjdk.org
Fri Sep 20 19:56:38 UTC 2024
On Tue, 17 Sep 2024 09:39:35 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>> Kangcheng Xu has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 22 additional commits since the last revision:
>>
>> - Merge branch 'openjdk:master' into arithmetic-canonicalization
>> - Merge pull request #1 from tabjy/arithmetic-canonicalization-v2
>>
>> Arithmetic canonicalization v2
>> - remove dead code
>> - fix potential void type const nodes
>> - refactor and cleanup
>> - add more test cases
>> - re-implement depth limit on recursion
>> - passes TestIRLShiftIdeal_XPlusX_LShiftC
>> - passes AddI[L]NodeIdealizationTests
>> - revert depth limits
>> - ... and 12 more: https://git.openjdk.org/jdk/compare/71681c74...c8fdb74c
>
> src/hotspot/share/opto/addnode.cpp line 490:
>
>> 488: if (bt == T_INT || bt == T_LONG) { // const could potentially be void type
>> 489: Node* mul_base;
>> 490: jlong multiplier = extract_base_operand_from_serial_additions(phase, operand_node, &mul_base, depth_limit - 1);
>
> Do you need to recurse at all here?
I believe so. Consider the case `(a + a) * 3`. Recurse here allows us to extract `a` and factor `2 * 3 => 6`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20754#discussion_r1769185209
More information about the hotspot-compiler-dev
mailing list