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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • 23
    • 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`.

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

              Created:
              Updated:
              Resolved: