http://llvm.org/bugs/show_bug.cgi?id=15514
Bug ID: 15514
Summary: Incorrect calling convention at -O0 for
x86_64-pc-win32 target
Product: libraries
Version: trunk
Hardware: PC
OS: Windows XP
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
On the following IR:
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-pc-win32"
define i32 @foo(i32* %p) {
entry:
%0 = load i32* %p, align 4
ret i32 %0
}
define i32 @main(i32 %argc, i8** %argv) {
entry:
%argc.addr = alloca i32, align 4
store i32 %argc, i32* %argc.addr, align 4
%call = call i32 @foo(i32* %argc.addr)
ret i32 %call
}
llc -O0 produces this for foo:
.def foo;
.scl 2;
.type 32;
.endef
.text
.globl foo
.align 16, 0x90
foo: # @foo
# BB#0: # %entry
pushq %rdi
pushq %rax
movq %rdi, (%rsp)
movl (%rdi), %eax
addq $8, %rsp
popq %rdi
re
llc -O1 produces the correct output.
So, it looks like -O0 is using the wrong calling convention (argument should be
in %rcx, not %rdi). Since this only happens at -O0, it could be something in
X86FastISel.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs