For a java code:
long tmp = val + 3;
long ret = callNoInlineMethod() + tmp;
the result of an ideal graph like this:
25 LoadL === _ 7 24 [[ 27 53 ]] #val
26 ConL === 0 [[ 52 27 ]] #var:3
27 AddL === _ 25 26 [[ 37 ]]
37 CallStaticJava === 5 6 7 8 1 (10 1 27 1 ) [[ 38 39 40 42 ]] #callNoInlineMethod
42 Proj === 37 [[ 53 ]]
52 AddL === _ 53 26 [[ 54 ]]
53 AddL === _ 42 25 [[ 52 ]]
Three AddL nodes have been generated here, actually, two AddL nodes should be sufficient, and "25 LoadL", "26 ConL", "27 AddL" all need to be saved on the stack before call "callNoInlineMethod()". A reasonable ideal graph should be:
25 LoadL === _ 7 24 [[ 27 ]] #val
26 ConL === 0 [[ 27 ]] #var:3
27 AddL === _ 25 26 [[ 37 ]]
37 CallStaticJava === 5 6 7 8 1 (10 1 27 1 ) [[ 38 39 40 42 ]] #callNoInlineMethod
42 Proj === 37 [[ 53 ]]
53 AddL === _ 42 27 [[ .. ]]
Here, only "27 AddL" need to be saved to stack and two AddL nodes is sufficient.
long tmp = val + 3;
long ret = callNoInlineMethod() + tmp;
the result of an ideal graph like this:
25 LoadL === _ 7 24 [[ 27 53 ]] #val
26 ConL === 0 [[ 52 27 ]] #var:3
27 AddL === _ 25 26 [[ 37 ]]
37 CallStaticJava === 5 6 7 8 1 (10 1 27 1 ) [[ 38 39 40 42 ]] #callNoInlineMethod
42 Proj === 37 [[ 53 ]]
52 AddL === _ 53 26 [[ 54 ]]
53 AddL === _ 42 25 [[ 52 ]]
Three AddL nodes have been generated here, actually, two AddL nodes should be sufficient, and "25 LoadL", "26 ConL", "27 AddL" all need to be saved on the stack before call "callNoInlineMethod()". A reasonable ideal graph should be:
25 LoadL === _ 7 24 [[ 27 ]] #val
26 ConL === 0 [[ 27 ]] #var:3
27 AddL === _ 25 26 [[ 37 ]]
37 CallStaticJava === 5 6 7 8 1 (10 1 27 1 ) [[ 38 39 40 42 ]] #callNoInlineMethod
42 Proj === 37 [[ 53 ]]
53 AddL === _ 42 27 [[ .. ]]
Here, only "27 AddL" need to be saved to stack and two AddL nodes is sufficient.
- links to
-
Review openjdk/jdk/18482