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

Fix for 8072422 is incorrect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • b127

      The fix for JDK-8072422 changed the following lines in loopTransform.cpp

      @@ -2258,7 +2203,7 @@
                 add_constraint( stride_con, scale_con, offset, zero, limit, pre_ctrl, &pre_limit, &main_limit );
                 if (!conditional_rc) {
                   // (0-offset)/scale could be outside of loop iterations range.
      - conditional_rc = !loop->dominates_backedge(iff) || RangeLimitCheck;
      + conditional_rc = !loop->dominates_backedge(iff);
                 }
               } else {
                 if (PrintOpto) {
      @@ -2294,7 +2239,7 @@
                   // ((MIN_INT+1)-offset)/scale could be outside of loop iterations range.
                   // Note: negative offset is replaced with 0 but (MIN_INT+1)/scale could
                   // still be outside of loop range.
      - conditional_rc = !loop->dominates_backedge(iff) || RangeLimitCheck;
      + conditional_rc = !loop->dominates_backedge(iff);
                 }
                 break;
               default:

      Both changes are incorrect because if RangeLimitCheck is always true, conditional_rc should be always true as well.

      There is also the following change in parse1.cpp:

      @@ -661,8 +661,7 @@
               // (Note that dead locals do not get phis built, ever.)
               ensure_phis_everywhere();
       
      - if (block->is_SEL_head() &&
      - (UseLoopPredicate || LoopLimitCheck)) {
      + if (block->is_SEL_head() && UseLoopPredicate) {
                 // Add predicate to single entry (not irreducible) loop head.
                 assert(!block->has_merged_backedge(), "only entry paths should be merged for now");
                 // Need correct bci for predicate.

      The "&& UseLoopPredicate" should be removed because the original statement is always true if LoopLimitCheck == true.

      And this change in loopnode.cpp

      @@ -2322,7 +2221,7 @@
         // Some parser-inserted loop predicates could never be used by loop
         // predication or they were moved away from loop during some optimizations.
         // For example, peeling. Eliminate them before next loop optimizations.
      - if (UseLoopPredicate || LoopLimitCheck) {
      + if (UseLoopPredicate) {
           eliminate_useless_predicates();
         }

      The if should be removed.

            thartmann Tobias Hartmann
            thartmann Tobias Hartmann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: