[llvm-bugs] [Bug 32230] New: Overestimated align on load

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 10 14:16:08 PST 2017


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

            Bug ID: 32230
           Summary: Overestimated align on load
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: moconnor at directstream.com
                CC: llvm-bugs at lists.llvm.org

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.

-- 
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/20170310/bbd26969/attachment.html>


More information about the llvm-bugs mailing list