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

C2 computes wrong trip count for loops

    XMLWordPrintable

Details

    Description

      The trip count computed by IdealLoopTree::compute_profile_trip_cnt() is wrong. Both of the following loops have 9 iterations:

              for (int i = 1; i < 10; i++) {

              }

              int i = 1;
              do {

              } while (++i < 10);

      But the trip count of the first one is computed as ~10 (9,9..):

      Loop: N0/N0 has_sfpt
        Loop: N180/N179 limit_check
          Loop: N181/N91 limit_check counted [1,10),+1 (-1 iters) has_sfpt strip_mined
        Loop: N191/N190 limit_check
          Loop: N192/N164 limit_check counted [2,10),+1 (-1 iters) has_sfpt strip_mined
      compute_profile_trip_cnt lp: 181 cnt: 9,986592

      compute_profile_trip_cnt lp: 192 cnt: 9,000001

      Attachments

        Issue Links

          Activity

            People

              roland Roland Westrelin
              thartmann Tobias Hartmann
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: