[llvm-bugs] [Bug 46518] New: Failure to vectorize a std::find across a dereferencable array

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 30 07:27:32 PDT 2020


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

            Bug ID: 46518
           Summary: Failure to vectorize a std::find across a
                    dereferencable array
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: florian_hahn at apple.com, lebedev.ri at gmail.com,
                    llvm-bugs at lists.llvm.org, spatel+llvm at rotateright.com

#include <array>
#include <algorithm>
bool findme(const std::array<int, 8> &db, int key) {
    return std::find(db.begin(), db.end(), key) != db.end();
}

https://godbolt.org/z/rdWStD

We end up with a full cmp+branch tree when we could very efficiently use a
vector comparison followed by an anyof reduction.

-- 
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/20200630/9d972602/attachment.html>


More information about the llvm-bugs mailing list