[llvm-bugs] [Bug 51436] New: Missed vectorization due to recently added transformation

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 10 13:12:01 PDT 2021


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

            Bug ID: 51436
           Summary: Missed vectorization due to recently added
                    transformation
           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

unsigned long long foo(unsigned long long a)
{
    return (1048575 - a) << 44;
}
void bar(unsigned long long *a)
{
    for (int i = 0; i < 8; i++)
        a[i] = foo(a[i]);
}


bar is no longer vectorized with LLVM 12+ since that pattern is now rewriten as
mulplication and addition.

LLVM 11:
foo(unsigned long long): # @foo(unsigned long long)
  shl rdi, 44
  movabs rax, -17592186044416
  sub rax, rdi
  ret


LLVM 12
foo(unsigned long long):                                # @foo(unsigned long
long)
        movabs  rax, -17592186044416
        imul    rdi, rax
        add     rax, rdi
        ret

LLVM 11:
remark: vectorized loop (vectorization width: 2, interleaved count: 2)
[-Rpass=loop-vectorize]
    for (int i = 0; i < N; i++)

LLVM 12:
remark: the cost-model indicates that vectorization is not beneficial
[-Rpass-missed=loop-vectorize]
    for (int i = 0; i < N; i++)


So looks like we have some issues in the cost model.


https://godbolt.org/z/c39qr7nvP

-- 
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/20210810/f557ed1d/attachment.html>


More information about the llvm-bugs mailing list