[LLVMbugs] [Bug 8014] New: Bottom-up FastISel broke tail calls

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 27 16:22:18 PDT 2010


           Summary: Bottom-up FastISel broke tail calls
           Product: libraries
           Version: trunk
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: dalej at apple.com
                CC: llvmbugs at cs.uiuc.edu

The rewrite of FastISel to go bottom-up doesn't work with tail calls.  Example:

; ModuleID = '<stdin>'
target datalayout =
target triple = "x86_64-apple-darwin11.0"

define i32 @foo() nounwind ssp {
 %0 = tail call i32 (...)* @bar() nounwind       ; <i32> [#uses=1]
 ret i32 %0


    .section    __TEXT,__text,regular,pure_instructions
    .globl    _foo
    .align    4, 0x90
_foo:                                   ## @foo
## BB#0:                                ## %entry
    xorb    %al, %al
    #TC_RETURN _bar $0
    movl    -4(%rsp), %eax          ## 4-byte Reload

Formerly, lowering the tail call set the IsTailCall flag, which caused an early
exit from the loop walking instructions, which meant the ret was never
selected.  emitEpilog lowered the TC_RETURN to TAILJMP, and all was well.  Now,
we select the RET, which means (a) it's there in the output when it shouldn't
be, because nobody ever deletes it, and (b) emitEpilog doesn't lower the
TC_RETURN because it's not the terminator.  Badness.

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