[LLVMbugs] [Bug 15514] New: Incorrect calling convention at -O0 for x86_64-pc-win32 target

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 14 11:04:29 PDT 2013


            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: unassignedbugs at nondot.org
          Reporter: jlerouge at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

On the following IR:

target datalayout =
target triple = "x86_64-pc-win32"

define i32 @foo(i32* %p) {
  %0 = load i32* %p, align 4
  ret i32 %0

define i32 @main(i32 %argc, i8** %argv) {
  %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;
    .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

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

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/20130314/258e2bf0/attachment.html>

More information about the llvm-bugs mailing list