<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 --- - mergefunc could improve in face of virtual methods?"
href="http://llvm.org/bugs/show_bug.cgi?id=15770">15770</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>mergefunc could improve in face of virtual methods?
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bruce.mitchener@gmail.com
</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=10360" name="attach_10360" title="Example C++ file">attachment 10360</a> <a href="attachment.cgi?id=10360&action=edit" title="Example C++ file">[details]</a></span>
Example C++ file
With emscripten, we'd like to be able to use the mergefunc optimization pass
and in looking at the results of using it, a lot of thunks are created for
virtual methods, presumably due to vtable references.
I've attached an example C++ file that demonstrates a very basic case of this.
Why do we need the thunk in this situation? Do we really need the bitcast?
I compiled the attached file as follows:
/usr/local/bin/clang++ -emit-llvm -S -o test.ll -c test.cpp
And then ran opt:
/usr/local/bin/opt -debug -mergefunc test.ll -o opt-test.bc
And that told me:
Args: /usr/local/bin/opt -debug -mergefunc test.ll -o opt-test.bc
size of module: 11
size of worklist: 8
Inserting as unique: main
Inserting as unique: _ZN1BC1Ev
Inserting as unique: _ZN1CC1Ev
Inserting as unique: _ZN1CC2Ev
Inserting as unique: _ZN1AC2Ev
Inserting as unique: _ZN1C3fooEi
Inserting as unique: _ZN1BC2Ev
_ZN1C3fooEi == _ZN1B3fooEi
writeThunk: _ZN1B3fooEi
size of FnSet: 7
Any chance this could be better?</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>