<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - llc handles pointer arithmetic in a strange way, Linux, trunk, regression from version 3.4"
   href="http://llvm.org/bugs/show_bug.cgi?id=20118">20118</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llc handles pointer arithmetic in a strange way, Linux, trunk, regression from version 3.4
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>llc
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ili.filippov@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12700" name="attach_12700" title="Reproducer">attachment 12700</a> <a href="attachment.cgi?id=12700&action=edit" title="Reproducer">[details]</a></span>
Reproducer

To reproduce:
llc reproducer.ll -mattr=+avx2 -o c.s (llc from trunk)
clang c.s test.cpp -O0 (any clang)

test.cpp:
#include <stdio.h>
extern "C" {
    extern void f_fu(float *result);
}
int main(int argc, char *argv[]) {
    float returned_result[64] __attribute__((aligned(64)));
    f_fu(returned_result);
    for (int i = 0; i < 8; ++i) {
        printf("%f, ", returned_result[i]);
    }
    printf("\n");
    return 0;
}
reproducer.ll is attached.

The right answer is
"6.000000, 7.000000, 8.000000, 9.000000, 10.000000, 11.000000, 12.000000,
13.000000,"
and if we take llc from 3.4 version we will have this answer. However llc from
trunk results in:
"6.000000, 15.000000, 8.000000, 9.000000, 2.000000, 11.000000, 12.000000,
13.000000,", which is wrong.</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>