[llvm-bugs] [Bug 33238] New: Wrong isl ast schedule generated

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 30 18:13:12 PDT 2017


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

            Bug ID: 33238
           Summary: Wrong isl ast schedule generated
           Product: Polly
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Other
          Assignee: polly-dev at googlegroups.com
          Reporter: huihuiz at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

Created attachment 18547
  --> https://bugs.llvm.org/attachment.cgi?id=18547&action=edit
test input

Attaching the test.ll as test input

Run command "opt -polly-codegen -S test.ll -debug"

Polly produce the isl ast schedule of:

    {
      if (p_0 >= 3) {
        for (int c0 = 0; c0 < (p_0 + 2) / 4; c0 += 1) {
          Stmt0(c0);
          if (p_0 >= 4 * c0 + 3) {
            Stmt2(c0);
            if (p_0 >= 4 * c0 + 4) {
              Stmt4(c0);
              if (p_0 >= 4 * c0 + 5)
                Stmt6(c0);
            }
          }
        }
        if ((p_0 - 1) % 4 == 0) {
          Stmt7();
        } else if (p_0 % 4 == 0) {
          Stmt5();
        } else if ((p_0 + 1) % 4 == 0) {
          Stmt3();
        }
      } else {
        Stmt0(0);
      }
      Stmt1();
    }

else
    {  /* original code */ }

However, the correct schedule should be:

    {
      if (p_0 >= 3) {
        for (int c0 = 0; c0 < (p_0 + 2) / 4; c0 += 1) {
          Stmt0(c0);
          if (p_0 >= 4 * c0 + 3) {
            Stmt2(c0);
            if (p_0 >= 4 * c0 + 4) {
              Stmt4(c0);
              if (p_0 >= 4 * c0 + 5)
                Stmt6(c0);
            }
          }
        }
        if ((p_0 - 1) % 4 == 0) {
          Stmt7();
        } else if (p_0 % 4 == 0) {
          Stmt5();
        } else if ((p_0 + 1) % 4 == 0) {
          Stmt3();
        }
      } else {
        Stmt0(0);
      }
      if((n <= 2) || ((n - 2)%4 == 0))
        Stmt1();
    }

else
    {  /* original code */ }

Notice that for Statement Stmt1(), Polly produce universe domain, Stmt1 is
being executed unconditionally. However, if going through the basic blocks of
the input test.ll file, Stmt1 will only be executed under condition "((n <= 2)
|| ((n - 2)%4 == 0))"

-- 
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/20170531/d495dc1b/attachment.html>


More information about the llvm-bugs mailing list