<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - RewriteStatepointsForGC probably shouldn't turn musttail calls into statepoints"
href="https://bugs.llvm.org/show_bug.cgi?id=36102">36102</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>RewriteStatepointsForGC probably shouldn't turn musttail calls into statepoints
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>benzrf@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=19753" name="attach_19753" title="A minimal example of input that the pass mangles">attachment 19753</a> <a href="attachment.cgi?id=19753&action=edit" title="A minimal example of input that the pass mangles">[details]</a></span>
A minimal example of input that the pass mangles
Applying the RewriteStatepointsForGC pass to a function definition that
contains a `musttail` call turns that call into a statepoint, which produces a
malformed module (since the parameter counts mismatch). The attached file is a
valid module, but running `opt -rewrite-statepoints-for-gc -S
tail_statepoint.ll` produces the following error message:
cannot guarantee tail call due to mismatched parameter counts
%statepoint_token = musttail call token (i64, i32, i32 (i32
addrspace(1)*)*, i32, i32, ...)
@llvm.experimental.gc.statepoint.p0f_i32p1i32f(i64 2882400000, i32 0, i32 (i32
addrspace(1)*)* @foo, i32 1, i32 0, i32 addrspace(1)* %x, i32 0, i32 0, i32
addrspace(1)* %x)
LLVM ERROR: Broken function found, compilation aborted!
As far as I can tell, the decision on whether to rewrite a given callsite is
made here:
<a href="https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp#L2522">https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp#L2522</a>
It seems to me that just adding a clause to verify that the call is not
`musttail` would be an improvement, but I'm not at all familiar with what other
repercussions it could possibly have.</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>