<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 generates incorrect tailcall on x86"
href="http://llvm.org/bugs/show_bug.cgi?id=19530">19530</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLVM generates incorrect tailcall on x86
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>kfischer@college.harvard.edu
</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>Consider the following LLVM IR:
```
$ cat test.ll
declare double @llvm.powi.f64(double %Val, i32 %power)
define <3 x double> @julia_foo17589(i64) {
top:
%1 = trunc i64 %0 to i32
%2 = call double @llvm.powi.f64(double 1.000000e+00, i32 %1)
%3 = insertelement <3 x double> undef, double %2, i32 0
%4 = call double @llvm.powi.f64(double 2.000000e+00, i32 %1)
%5 = insertelement <3 x double> %3, double %4, i32 1
%6 = call double @llvm.powi.f64(double 3.000000e+00, i32 %1)
%7 = insertelement <3 x double> %5, double %6, i32 2
ret <3 x double> %7
}
define i64 @main(i32) {
%arg = zext i32 %0 to i64
%a = call <3 x double> @julia_foo17589(i64 %arg)
%b = extractelement <3 x double> %a, i32 0
%c = fcmp ueq double %b, 1.000000e+00
%d = zext i1 %c to i64
ret i64 %d
}
```
Calling `llc -O0 -mcpu=core2 test.ll`
gives (exerted below)
```
_julia_foo17589: ## @julia_foo17589
.cfi_startproc
## BB#0: ## %top
movl %edi, %eax
movsd LCPI0_0(%rip), %xmm0
movl %eax, %edi
jmp ___powidf2 ## TAILCALL
.cfi_endproc
```
The tailcall there is incorrect and gives the wrong result. This is machine
dependent and works correctly on some machines (without the -mcpu), but not
others.</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>