-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
better codegen for slices in parameters and return values #561
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
Labels
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
frontend
Tokenization, parsing, AstGen, Sema, and Liveness.
optimization
Milestone
Comments
andrewrk
added a commit
that referenced
this issue
Sep 20, 2019
Currently, slices are passed via reference, even though it would be better to pass the ptr and len as separate arguments (#561). This means that any function call with a slice parameter cannot be a tail call, because according to LLVM spec: > Both [tail,musttail] markers imply that the callee does not access > allocas from the caller There was one other place we were setting `tail` and I made that conditional on whether or not the argument referenced allocas in the caller. This was causing undefined behavior in the compiler when it hit asserts, causing it to print garbage memory to the terminal. See #3262 for example.
andrewrk
added a commit
that referenced
this issue
Jul 19, 2022
LLVM optimization passes handle this better, and it allows Zig to specify pointer parameter attributes such as readonly, nonnull, noalias, and alignment. closes #561
wooster0
pushed a commit
to wooster0/zig
that referenced
this issue
Jul 24, 2022
LLVM optimization passes handle this better, and it allows Zig to specify pointer parameter attributes such as readonly, nonnull, noalias, and alignment. closes ziglang#561
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
frontend
Tokenization, parsing, AstGen, Sema, and Liveness.
optimization
https://bugs.llvm.org/show_bug.cgi?id=34952#c10
This would also solve #536.
It would make #560 easier to implement.
Be sure to measure performance before and after.
The text was updated successfully, but these errors were encountered: