[LLVMbugs] [Bug 19530] New: LLVM generates incorrect tailcall on x86
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Apr 23 09:41:39 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19530
Bug ID: 19530
Summary: LLVM generates incorrect tailcall on x86
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: kfischer at college.harvard.edu
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140423/feaee357/attachment.html>
More information about the llvm-bugs
mailing list