[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


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

           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 =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin11.0"

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

Output:

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

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