[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


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

           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 =
"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"
target triple = "i386-pc-linux-gnu"

define cc10 void @__stginit_ZCMain(i32* %Base_Arg, i32* %Sp_Arg, i32* %Hp_Arg,
i32 %R1_Arg) nounwind {
cm1:
  %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:

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

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

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

Cheers,
David

-- 
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