[llvm-bugs] [Bug 25793] New: [polly] The order of the loop is reversed while not necessary

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 9 18:09:44 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25793

            Bug ID: 25793
           Summary: [polly] The order of the loop is reversed while not
                    necessary
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: lawrence at codeaurora.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15426
  --> https://llvm.org/bugs/attachment.cgi?id=15426&action=edit
reduced testcase

Polly schedule changed the order of the loop unnecessaryly.

Here is the original order of the loop in c:


void foo (int * restrict A, int * restrict B, int * restrict C, int n) {
  for(int i = 0; i < n; i++)
    A[i] += 1;
  for(int i = 0; i < n; i++)
    B[i] += 1;
  for(int i = 0; i < n; i++)
    C[i] += 1;
}


Polly schedule reorder the loops to:

void foo (int * restrict A, int * restrict B, int * restrict C, int n) {
  for(int i = 0; i < n; i++)
    C[i] += 1;
  for(int i = 0; i < n; i++)
    A[i] += 1;
  for(int i = 0; i < n; i++)
    B[i] += 1;
}

Here is the isl ast for attached IR
    { 
      #pragma simd
      #pragma known-parallel
      for (int c0 = 0; c0 < n; c0 += 1)
        Stmt_for_body16(c0);
      #pragma simd 
      #pragma known-parallel
      for (int c0 = 0; c0 < n; c0 += 1)
        Stmt_for_body(c0);
      #pragma simd
      #pragma known-parallel
      for (int c0 = 0; c0 < n; c0 += 1)
        Stmt_for_body5(c0);
    }

Even though it is logically correct, however it is not necessary, and afffect
readability.

Use opt -debug -polly  -polly-detect -polly-opt-isl -polly-codegen
-polly-vectorizer=polly -polly-ignore-aliasing -S <t.ll >log.log 2>&1 to
reproduce it

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151210/d7c22290/attachment.html>


More information about the llvm-bugs mailing list