<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 --- - Add support for inlining through musttail thunks"
href="http://llvm.org/bugs/show_bug.cgi?id=22288">22288</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Add support for inlining through musttail thunks
</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>Windows NT
</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>Interprocedural Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>rnk@google.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rnk@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>david.majnemer@gmail.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Missing optimization request extracted from
<a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED --- - [ASan/Win] ASan gtests are not run as part of "ninja check-asan""
href="show_bug.cgi?id=20944#c10">http://llvm.org/bugs/show_bug.cgi?id=20944#c10</a> :
In the future, we should teach the inliner how to inline through thunks like
this:
define double @f(i8* %a, i32 %b, i32 %c) {
entry:
%call = call x86_thiscallcc double bitcast (void (i8*, ...)* @thunk to double
(i8*, i32, i32)*)(i8* %a, i32 %b, i32 %c)
ret double %call
}
define linkonce_odr x86_thiscallcc void @thunk(i8* %this, ...) #0 {
entry:
%0 = bitcast i8* %this to void (i8*, ...)**
%1 = load void (i8*, ...)** %0
musttail call x86_thiscallcc void (i8*, ...)* %1(i8* %this, ...)
ret void
}
attributes #0 = { "thunk" }
--- New IR ---
define double @f(i8* %a, i32 %b, i32 %c) {
entry:
%0 = bitcast i8* %a to void (i8*, ...)**
%1 = load void (i8*, ...)** %0
%2 = bitcast void (i8*, ...)* %1 to double (i8*, i32, i32)* ; new bitcast
%3 = tail call double %2(i8* %a, i32 %b, i32 %c) ; fill in missing parameters
and use the result of the expected type
ret double %3
}
Basically, push the bitcast on the function prototype through to the musttail
call sites. The musttail call site will always have a prototype matching the
thunk, so this shouldn't require instcombine-like bitcast insertion logic, it's
just a bitcast of the function prototype. Follow-on optimizations can clean up
the cast.</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>