C2 should optimize long-typed parallel iv in an int counted loop

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 24
    • Affects Version/s: 23
    • Component/s: hotspot
    • b21
    • generic
    • generic

      Current parallel iv optimization only happens in an int counted loop with int-typed parallel iv's. Optimization for the following code should be considered:

        private static long testIntCountedLoopWithLongIv(int stop) {
                long a = 0; // <-- typed long
                for (int i = 0; i < stop; i++) {
                    a += 42; // <-- 42 is a long constant
                }
        
                return a;
        }

      where the value of `a` should be eventually optimized to a constant time operation dependent on `stop`.

            Assignee:
            Kangcheng Xu
            Reporter:
            Kangcheng Xu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: