[LLVMbugs] [Bug 7610] New: Sibling call optimization broken

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 9 08:32:24 PDT 2010


           Summary: Sibling call optimization broken
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: davidterei at gmail.com
                CC: llvmbugs at cs.uiuc.edu

In LLVM trunk the Sibling call optimization seems to be broken. Specifically it
doesn't catch as many cases as it does in 2.7. The case it no longer catches I
think is calls to unknown functions (e.g function pointers).

Example LLVM stub program:

target datalayout =
target triple = "i386-pc-linux-gnu"

define cc10 void @__stginit_ZCMain(i32* %Base_Arg, i32* %Sp_Arg, i32* %Hp_Arg,
i32 %R1_Arg) nounwind {
  %nm3 = getelementptr i32* %Sp_Arg, i32 1
  %nm9 = load i32* %Sp_Arg
  %nma = inttoptr i32 %nm9 to void (i32*, i32*, i32*, i32)*
  tail call cc10 void %nma(i32* %Base_Arg, i32* %nm3, i32* %Hp_Arg, i32
%R1_Arg) nounwind
  ret void

Under 2.8svn this compiles with 'llc -O3' to:

        subl    $4, %esp
        movl    %ebp, %eax
        leal    4(%eax), %ebp
        call    *(%eax)
        addl    $4, %esp

Under 2.7 this compiles with 'llc -O3' to:

        movl    (%ebp), %eax
        addl    $4, %ebp
        jmpl    *%eax


Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list