<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 - Overestimated align on load"
   href="https://bugs.llvm.org/show_bug.cgi?id=32230">32230</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Overestimated align on load
          </td>
        </tr>

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

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

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

        <tr>
          <th>Reporter</th>
          <td>moconnor@directstream.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This C++ code:

    #include <cstdint>
    using namespace std;

    void test(uint8_t *ptr, long *buf, int const N) {
      for (int I = 0; I < N - 7; ++I) {
        uint64_t big = *(uint64_t *)(ptr + I);
        buf[I] = big * big;
      }
    }

When compiled with:

    clang++ -std=c++11 -S -emit-llvm -O2 -fno-unroll-loops test.cpp -o test.ll

Produces a:

    %2 = load i64, i64* %1, align 8

Even when that load cannot be 8-byte aligned since it's stepping through `ptr`
a byte at a time.

I've tested this and seen this behavior on 3.8.0 and 4.0.0-rc4.
-fno-unroll-loops is only present to clean up the generated IR and doesn't
appear to affect the production of that load.</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>