[llvm-bugs] [Bug 34936] New: False dependency in x86 popcnt instruction unknown to llvm causes slow code

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 12 17:07:20 PDT 2017


            Bug ID: 34936
           Summary: False dependency in x86 popcnt instruction unknown to
                    llvm causes slow code
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: justin.lebar at gmail.com
                CC: llvm-bugs at lists.llvm.org

clang/LLVM at head seems to be affected by the bug described here:

The etiology established in the SO post is that in the hardware, "popcount dst,
src" has a false dependency on dst.  If the compiler isn't aware of this, it
makes bad decisions during register assignment.

$ curl
369/raw/ec4705c992f355258c292da5ba21ca0c7abaa119/- | clang++ -O3 -march=haswell
--std=c++11 -x c++ - -o test && ./test 1

On a Haswell machine, I get

unsigned        41959360000     0.592057 sec    17.7107 GB/s
uint64_t        41959360000     0.823331 sec    12.7358 GB/s

which exhibits the bug by being significantly slower in the case where the loop
induction variable is uint64_t.

Disassembly is at
https://gist.github.com/anonymous/47496363b7a4f15ffd57038492afb3e3 -- based on
my (nonexpert) analysis, it seems plausible that the etiology from SO applies

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/20171013/47b12be4/attachment-0001.html>

More information about the llvm-bugs mailing list