[LLVMbugs] [Bug 21185] New: LLVM 15 times slower than gcc compiling the erlang VM-core

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 7 06:47:39 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21185

            Bug ID: 21185
           Summary: LLVM 15 times slower than gcc compiling the erlang
                    VM-core
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: frej at sics.se
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13159
  --> http://llvm.org/bugs/attachment.cgi?id=13159&action=edit
Preprocessed input

[This bug report is on LLVM and Clang 3.5 from the git mirror, (LLVM:
 df820bfd87d7d70d8f1a739333496e191631a3e2; Clang:
 870571e52b265a9a471196b1cda93445c9262541;)
 release-compiled without assertions]

Compiling the core interpreter module of the Erlang VM [1] triggers
non-linear behaviour of LLVM's code generator.

The C-module in question is erts/emulator/beam/beam_emu.c in [1], for
convenience i have attached the preprocessed input to this bug-report.

Compiling beam_emu.c using clang -O3 takes roughly 45s, compiling it
using gcc -O3 takes 3s. Running:

clang -O3 -emit-llvm beam_emu-clang.i -o beam_emu.bc takes 2s

llc -O3 llc -O3 beam_emu-clang.bc takes 43s [bitcode attached]

Which indicates that the slow-down is in the common code generation
code.

Using a profile-enabled llc I can see that (60%) of the runtime is
spent inside LiveVariables::isLiveOut() as called from
PHIElimination::runOnMachineFunction().

For analyzing this bug it may help to know that beam_emu.c implements
a directly threaded interpreter. For each VM instruction there is a
first-class label followed by code implementing the instruction (much
of it automatically generated). Each instruction ends with a goto*
which branches to the next VM instruction.

As part of the BEAMJIT-project[2] we extend the VM by adding
additional entry points. The resulting three-fold increase in the
number of basic blocks increases the run-time to 30min, which may
serve as a hint to what is wrong.


[1] http://www.erlang.org/download/otp_src_17.3.tar.gz
erts/emulator/beam/beam_emu.c

[2] http://llvm.org/devmtg/2014-04/PDFs/Talks/drejhammar.pdf

-- 
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/20141007/850fbdf9/attachment.html>


More information about the llvm-bugs mailing list