<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 - An optimization error about loop unrolling"
   href="https://bugs.llvm.org/show_bug.cgi?id=42382">42382</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>An optimization error about loop unrolling
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>witstorm@163.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In the experiment, when clang uses O2 and O3 optimization options, the pass of
Loop unrolling will cause an result error.The procedure is as follows:
typedef int A __attribute__((vector _size(64),aligned(64)));
A Aa,Ab,Ai;
static __inline A __attribute__((__always_inline__))
SET_A (int __A,int __B,int __C,int __D,int __E,int __F,int __G,int __H,int
__I,int __J,int __K,int __L,int __M,int __N,int __O,int __P){
  union{
   int __a[16] __attribute__((aligned(64)));
   A __v;
}__u;
  __u.__a[0]=__A;
  __u.__a[1]=__B;
  __u.__a[2]=__C;
  __u.__a[3]=__D;
  __u.__a[4]=__E;
  __u.__a[5]=__F;
  __u.__a[6]=__G;
  __u.__a[7]=__H;
  __u.__a[8]=__I;
  __u.__a[9]=__J;
  __u.__a[10]=__K;
  __u.__a[11]=__L;
  __u.__a[12]=__M;
  __u.__a[13]=__N;
  __u.__a[14]=__O;
  __u.__a[15]=__P;
return __u.__v;
}
int main(){
   int
r[16]={2047,2047,2047,2047,2047,2047,2047,2047,2047,2047,2047,2047,2047,2047,2047,2047};
   int i;
   for(i=1024;i>=1;i>>=1){
   Ai=SET_A(i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i);
   Aa^=Aa>>i;
   Ab+=Aa+Ai;
}
}
You can reproduce the error with the following command:
clang -arch=x86 -static -O2 -emit-llvm -S a.c
Loop unrolling optimization produces incorrect values in IR.</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>