RFR: 8303970: C2 can not merge homogeneous adjacent two If [v3]

Yi Yang yyang at openjdk.org
Tue Mar 14 12:43:19 UTC 2023


> Hi, can I have a review for this patch? It adds new Identity for BoolNode to lookup homogenous integer comparison, i.e. `Bool (CmpX a b)` is identity to `Bool (CmpX b a)`, in this way, we are able to merge the following two "identical" Ifs, which is not before.
> 
> 
>     public static void test(int a, int b) { // ok, identical ifs, apply split_if
>         if (a == b) {
>             int_field = 0x42;
>         } else {
>             int_field = 42;
>         }
>         if (a == b) {
>             int_field = 0x42;
>         } else {
>             int_field = 42;
>         }
>     }
> 
>     public static void test(int a, int b) { // do nothing
>         if (a == b) {
>             int_field = 0x42;
>         } else {
>             int_field = 42;
>         }
>         if (b == a) {
>             int_field = 0x42;
>         } else {
>             int_field = 42;
>         }
>     }
> 
> 
> Testing: tier1, appllication/ctw/modules

Yi Yang has updated the pull request incrementally with one additional commit since the last revision:

  review from tobias

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12978/files
  - new: https://git.openjdk.org/jdk/pull/12978/files/f85fac8f..eaa0c440

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12978&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12978&range=01-02

  Stats: 58 lines in 3 files changed: 39 ins; 12 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/12978.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12978/head:pull/12978

PR: https://git.openjdk.org/jdk/pull/12978


More information about the hotspot-compiler-dev mailing list