[DRAFT] codegen: Copy to an alloca when the argument is neither by-val nor by-move for indirect pointer.#155343
Draft
dianqk wants to merge 1 commit intorust-lang:mainfrom
Draft
[DRAFT] codegen: Copy to an alloca when the argument is neither by-val nor by-move for indirect pointer.#155343dianqk wants to merge 1 commit intorust-lang:mainfrom
dianqk wants to merge 1 commit intorust-lang:mainfrom
Conversation
dianqk
commented
Apr 15, 2026
| self.codegen_argument( | ||
| bx, | ||
| op, | ||
| // Pass by-move for an explicit tail call, which has been handled above as well. |
Member
Author
There was a problem hiding this comment.
This feels a bit awkward; perhaps the tail call handling can be moved into codegen_argument as well.
Member
There was a problem hiding this comment.
The issue has nothing to do with tail calls, does it...?
Member
There was a problem hiding this comment.
But this PR is changing something about tail calls...?
Maybe it's just the comment that is confusing me. Why is it okay to always to by-move for tail call arguments? Cc @folkertdev
dianqk
commented
Apr 15, 2026
| // CHECK: call void @test_simd(<4 x i32> <i32 2, i32 4, i32 6, i32 8> | ||
| test_simd(const { Simd::<i32, 4>([2, 4, 6, 8]) }); | ||
|
|
||
| // CHECK: call void @test_simd_unaligned(%"minisimd::PackedSimd<i32, 3>" %1 |
Member
Author
There was a problem hiding this comment.
A redundant memcpy is skipped here.
…-move for indirect pointer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #155241.
We should always copy to an alloca when passing the argument indirectly via a hidden pointer; the only exception is for by-val or by-move.
I haven't added test cases yet.