Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need support for true tail calls #1764

Closed
lattner opened this issue May 6, 2007 · 2 comments
Closed

Need support for true tail calls #1764

lattner opened this issue May 6, 2007 · 2 comments
Labels
bugzilla Issues migrated from bugzilla enhancement Improving things as opposed to bug fixing, e.g. new or missing feature llvm:codegen

Comments

@lattner
Copy link
Collaborator

lattner commented May 6, 2007

Bugzilla Link 1392
Resolution FIXED
Resolved on Dec 02, 2010 01:20
Version 1.0
OS All
CC @nlewycky

Extended Description

Some testcases:


; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep {jmp \*ecx}
declare int %putchar(int)

int %main(){
%f = cast int (int, int*, int)* %check_tail to int*
%res = tail call fastcc int %check_tail( int 10, int* %f,int 10)
ret int %res
}

fastcc int %check_tail(int %x, int* %f, int %g) {
%tmp1 = setgt int %x, 0
br bool %tmp1, label %if-then, label %if-else

if-then:
%fun_ptr = cast int* %f to int(int, int*, int)*
%arg1 = add int %x, -1
call int %putchar(int 90)
%res = tail call fastcc int %fun_ptr( int %arg1, int * %f, int %g)
ret int %res

if-else:
ret int %x
}


; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | not grep call
fastcc int %bar(int %X, int(double, int) *%FP) {
%Y = tail call fastcc int %FP(double 0.0, int %X)
ret int %Y
}

@llvmbot
Copy link
Collaborator

llvmbot commented Sep 12, 2008

I added these two test cases to llvm tests. Commit 56127. They do work. The option -tailcallopt needs to be enabled to get tail call optimization. I think this bug should be closed?

regards

@lattner
Copy link
Collaborator Author

lattner commented Dec 2, 2010

Per comment #​1, arnold implemented this a long time ago.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
@Endilll Endilll added enhancement Improving things as opposed to bug fixing, e.g. new or missing feature and removed missing-feature labels Aug 15, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla enhancement Improving things as opposed to bug fixing, e.g. new or missing feature llvm:codegen
Projects
None yet
Development

No branches or pull requests

3 participants