RFR: 8328865: [c2] No need to convert "(x+1)+y" into "(x+y)+1" when y is a CallNode

Vladimir Kozlov kvn at openjdk.org
Tue Mar 26 16:37:26 UTC 2024


On Tue, 26 Mar 2024 07:17:21 GMT, SUN Guoyun <duke at openjdk.org> wrote:

> This patch prohibits the conversion from  "(x+1)+y" into "(x+y)+1" when y is a CallNode to reduce unnecessary spillcode and ADDNode.
> 
> Testing: tier1-3 in x86_64 and LoongArch64

I think it is not a call node but (x+1) result is used by debug info of call node.
For example, next code could be the same issue (I did not verified it):

     static int y = 0;
...
     int foo(int x, int z) {
         int a = x + 1;
         y = a;
         return a + z;
     }

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

PR Review: https://git.openjdk.org/jdk/pull/18482#pullrequestreview-1961080991


More information about the hotspot-compiler-dev mailing list