<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Loop-interchange : Some triangular loop nests are interchanged"
   href="https://bugs.llvm.org/show_bug.cgi?id=49306">49306</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Loop-interchange : Some triangular loop nests are interchanged
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>opt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>flemairen6@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang -Os -mllvm -enable-loopinterchange=true traingular_fail.c && ./a.out
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

$ clang -Os -mllvm -enable-loopinterchange=false triangular_fail.c && ./a.out
0 2 7 83 0 0 9 43 0 0 0 0 0 0 0 0


$ cat triangular_fail.c
#include <stdio.h>

int foo() {

  int A[4][4] = {{ 0, 0, 0, 0},
                { 0, 0, 0, 0},
                { 0, 0, 0, 0},
                { 0, 0, 0, 0}};
  int B[4][4] = {{ 16, 2, 7, 83},
                { 35, 8, 9, 43},
                { 47, 123, 32, 0},
                { 21, 11, 19, 29}};
  for (int i = 0; i < 4; ++i)
    for (int j = 0; j < i; ++j)
      A[j][i] = B[j][i];

  for (int i = 0; i < 4; ++i)
    for (int j = 0; j < 4; j++)
      printf("%d ", A[i][j]);

  printf("\n");

  return 0;
}

int main() {
  foo();
 return 0;
}

LoopInterchange does not detect the issue with the operation `j<i` in the inner
loop, thus, breaking the program correctness.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>