RFR(M): 8080289: Intermediate writes in a loop not eliminated by optimizer (original) (raw)

Roland Westrelin roland.westrelin at oracle.com
Wed Jun 10 15:03:55 UTC 2015


http://cr.openjdk.java.net/~roland/8080289/webrev.00/

Sink stores out of loops when possible:

for (int i = 0; i < 1000; i++) { // Some stuff that doesn’t prevent the optimization array[idx] = i; }

becomes:

for (int i = 0; i < 1000; i++) { // Some stuff } array[idx] = 999;

Or move stores before the loop when possible:

for (int i = 0; i < 1000; i++) { array[idx] = 999; // Some stuff that doesn’t prevent the optimization }

becomes:

array[idx] = 999; for (int i = 0; i < 1000; i++) { // Some stuff }

The change in memnode.cpp is useful to clean up code generated from test_after_5 because the stores are moved out of the loop only after the loop is split and unrolled. That code removes duplicate stores.

Roland.



More information about the hotspot-compiler-dev mailing list