RFR: 8324630: C1: Canonicalizer::do_LookupSwitch doesn't break the loop when the successor is found
Dean Long
dlong at openjdk.org
Fri Jan 26 08:34:34 UTC 2024
On Wed, 24 Jan 2024 13:37:05 GMT, Denghui Dong <ddong at openjdk.org> wrote:
> Hi,
>
> Please review the small change that breaks the loop in Canonicalizer::do_LookupSwitch if the successor is found.
>
> The keys of LookupSwitch are sorted, so there is no need to continue the loop once matched.
>
> Thanks.
src/hotspot/share/c1/c1_Canonicalizer.cpp line 848:
> 846: if (v == x->key_at(i)) {
> 847: sux = x->sux_at(i);
> 848: break;
Shouldn't we also break when `v < x->key_at(i) `, meaning no key will match? Maybe we should consider binary search?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17553#discussion_r1467351976
More information about the hotspot-compiler-dev
mailing list