<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - LLVM 15 times slower than gcc compiling the erlang VM-core"
href="http://llvm.org/bugs/show_bug.cgi?id=21185">21185</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLVM 15 times slower than gcc compiling the erlang VM-core
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>frej@sics.se
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=13159" name="attach_13159" title="Preprocessed input">attachment 13159</a> <a href="attachment.cgi?id=13159&action=edit" title="Preprocessed input">[details]</a></span>
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] <a href="http://www.erlang.org/download/otp_src_17.3.tar.gz">http://www.erlang.org/download/otp_src_17.3.tar.gz</a>
erts/emulator/beam/beam_emu.c
[2] <a href="http://llvm.org/devmtg/2014-04/PDFs/Talks/drejhammar.pdf">http://llvm.org/devmtg/2014-04/PDFs/Talks/drejhammar.pdf</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>