[llvm-bugs] [Bug 52462] New: Missed removal of cross-iteration dep in Loop Vectorizer

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 10 00:55:11 PST 2021


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

            Bug ID: 52462
           Summary: Missed removal of cross-iteration dep in Loop
                    Vectorizer
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

#include<stdint.h>

void
foo (uint64_t* __restrict pdst, uint64_t* psrc, uint64_t shift)
{
    for (int64_t i = 0; i != 64; i++)
    {
      uint64_t shift_i = shift >> i;
      pdst[i] = psrc[i] + shift_i;
    }
}

void
bar (uint64_t* __restrict pdst, uint64_t* psrc, uint64_t shift)
{
    for (int64_t i = 0; i != 64; i++)
    {
      pdst[i] = psrc[i] + shift;
      shift >>= 1;
    }
}


LLVM/GCC can vectorize foo but not bar since there's cross-iteration dep for
shift >>= 1, but shift >>= 1 is just shift >> i in loop.


https://godbolt.org/z/GfccMhszc

-- 
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/20211110/07d0d29a/attachment.html>


More information about the llvm-bugs mailing list