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

Add support for tail calls #900

Open
nunoplopes opened this issue Mar 24, 2023 · 0 comments
Open

Add support for tail calls #900

nunoplopes opened this issue Mar 24, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@nunoplopes
Copy link
Member

We have positives in GVN because of missing support for tail calls.
see, e.g.: llvm/llvm-project#61670
https://alive2.llvm.org/ce/z/GssD2L

define i64 @src(i64 noundef %arg) {
  %call2 = alloca i64
  %call3 = alloca i64
  store i64 %arg, ptr %call2, align 8
  tail call void @llvm.memcpy.p0.p0.i64(ptr %call3, ptr %call2, i64 8, i1 false)
  %load1 = load i64, ptr %call3, align 8
  ret i64 %load1
}

declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg)

$ opt -p gvn
define i64 @src(i64 %arg) {
  %call2 = alloca i64, align 8
  %call3 = alloca i64, align 8
  store i64 %arg, ptr %call2, align 8
  tail call void @llvm.memcpy.p0.p0.i64(ptr %call3, ptr %call2, i64 8, i1 false)
  ret i64 undef
}
@nunoplopes nunoplopes added the enhancement New feature or request label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant