[LLVMbugs] [Bug 8925] New: Unnecessary munging of stack pointer with guarantee tail calls

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 6 18:03:50 PST 2011


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

           Summary: Unnecessary munging of stack pointer with guarantee
                    tail calls
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: arplynn at gmail.com
                CC: llvmbugs at cs.uiuc.edu


In the following test case:

define fastcc i32* @force.ri32(i32* %x) nounwind {
entry:
  %nz = icmp eq i32* %x, null
  br i1 %nz, label %Limpl1.pre, label %Limpl0.pre

Limpl0.pre:                                       ; preds = %entry
  ret i32* %x

Limpl1.pre:                                       ; preds = %entry
  tail call fastcc void @pr.error() noreturn nounwind
  unreachable
}

declare fastcc void @pr.error() noreturn nounwind

LLVM currently generates:

_force.ri32:                            ## @force.ri32
## BB#0:                                ## %entry
        subq    $8, %rsp
        testq   %rdi, %rdi
        je      LBB0_2
## BB#1:                                ## %Limpl0.pre
        movq    %rdi, %rax
        addq    $8, %rsp
        ret     $8
LBB0_2:                                 ## %Limpl1.pre
        addq    $8, %rsp
        jmp     _pr.error               ## TAILCALL

The instructions that change %rsp are unnecessary.

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