[LLVMbugs] [Bug 15250] New: regparm(3) function can't be called with PIC on i686

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 12 16:53:58 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15250

            Bug ID: 15250
           Summary: regparm(3) function can't be called with PIC on i686
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This testcase .ll file:

; ModuleID = 'b.bc'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
target triple = "i386-unknown-linux-gnu"

define void @test(i32 %a, i32 %b) nounwind {
  tail call void @callee(i32 inreg 0, i32 inreg 0, i32 inreg 0) nounwind
  ret void
}

declare void @callee(i32 inreg, i32 inreg, i32 inreg)

fails to build:

nlewycky at ducttape:~$ llvm/Debug+Asserts/bin/llc -relocation-model=pic b.ll
LLVM ERROR: ran out of registers during register allocation

but it works without PIC. The input source to cause this from clang is:

  void __attribute((regparm(3))) callee(int, int, int);
  void test(int a, int b) {
    callee(0, 0, 0);
  }

which gcc handles like so:

nlewycky at ducttape:~$ gcc -S -m32 -O2 -fPIC z.i -o -
        .file   "z.i"
        .text
        .p2align 4,,15
        .globl  test
        .type   test, @function
test:
.LFB0:
        .cfi_startproc
        pushl   %ebx
        .cfi_def_cfa_offset 8
        .cfi_offset 3, -8
        xorl    %ecx, %ecx
        call    __i686.get_pc_thunk.bx
        addl    $_GLOBAL_OFFSET_TABLE_, %ebx
        subl    $8, %esp
        .cfi_def_cfa_offset 16
        xorl    %edx, %edx
        xorl    %eax, %eax
        call    callee at PLT
        addl    $8, %esp
        .cfi_def_cfa_offset 8
        popl    %ebx
        .cfi_def_cfa_offset 4
        .cfi_restore 3
        ret
        .cfi_endproc
.LFE0:
        .size   test, .-test
        .section       
.text.__i686.get_pc_thunk.bx,"axG", at progbits,__i686.get_pc_thunk.bx,comdat
        .globl  __i686.get_pc_thunk.bx
        .hidden __i686.get_pc_thunk.bx
        .type   __i686.get_pc_thunk.bx, @function
__i686.get_pc_thunk.bx:
.LFB1:
        .cfi_startproc
        movl    (%esp), %ebx
        ret
        .cfi_endproc
.LFE1:
        .ident  "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
        .section        .note.GNU-stack,"", at progbits

-- 
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/20130213/bd4ad623/attachment.html>


More information about the llvm-bugs mailing list