C2 should optimize long accumulations in a counted loop

XMLWordPrintable

      In:

      public static long testLongAcc() {
         long acc = 0;

         for (int i = 0; i < 1000; i++) {
             acc += 8;
         }

         return acc;
      }

      C2 doesn't optimize the loop out while in:

      public static long testIntAcc() {
         int acc = 0;

         for (int i = 0; i < 1000; i++) {
             acc += 8;
         }

         return acc;
      }

      it does

            Assignee:
            Kangcheng Xu
            Reporter:
            Roland Westrelin
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: