Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8294838

C2: Empty LongCountedLoops are not removed in do_remove_empty_loop

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 20, 21
    • hotspot

      I just ran a test I recently modified with flag
      -XX:StressLongCountedLoop=200000000

      compiler/loopopts/TestRemoveEmptyLoop.java
      In test_collapse, we have a 50000 iteration loop, that calls test_collapse_helper in each iteration.
      test_collapse_helper has a nested loop, the outer has about 19325 iterations, the inner 32767. This would take too long, but the inner loop is collapsed because it is empty.
      With the stress flag, we turn this inner loop into a long-loop, which we do not collapse, hence the test times out.

      Background on StressLongCountedLoop:
      An int loop like:
      for (int i = start; i < stop; i++) {
      }

      is transformed into:
      for (long i = start; i < stop; i++) {
      }

      then transformed into:
      for (long i = start; i < stop;) { // that one should run for few iterations
        for (int ii = 0; ii < ..; ii++) { // that one should collapse
        }
        i += ii;
      }

      As far as I can tell, the int-loop inside the long-loop still collapses. I tested running with StressLongCountedLoop 20, and it was relatively fast, and with 200 it was 10x slower.

      We would expect that the long-loop should collapse in this test, if empty LongCountedLoops were removed / collapsed.

      For now, I will disable the flag in the test, see subtask.

      Thanks [~roland] for the help with understanding what happened here.

      ------------- To reproduce the timeout:
      ~/Documents/jtreg/build/images/jtreg/bin/jtreg -timeout:1 -va -s -jdk:/home/emanuel/Documents/fork-jdk/build/linux-x64-slowdebug/jdk/ -javaoptions:"-XX:StressLongCountedLoop=200000000" /home/emanuel/Documents/fork-jdk/open/test/hotspot/jtreg/compiler/loopopts/TestRemoveEmptyLoop.java

            roland Roland Westrelin
            epeter Emanuel Peter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: