-
Notifications
You must be signed in to change notification settings - Fork 18k
[Clang] Forward incoming Indirect parameters across musttail calls #199351
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
Open
xroche
wants to merge
26
commits into
llvm:main
Choose a base branch
from
xroche:musttail-byval-temp-fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
cf30821
[Clang] Forward incoming Indirect parameters across musttail calls
xroche a1c3fd3
[Clang][NFC] Trim comments on musttail Indirect forwarding helper
xroche 11cdbbf
[Clang] Address review on musttail Indirect forwarding
xroche 4359083
[Clang] Extend musttail Indirect forwarding to C++ trivial-copy args
xroche 9b1aa8b
[Clang][test] Mirror C test cases in musttail-indirect-arg.cpp
xroche 99dfa79
[Clang] Switch musttail Indirect to a two-phase general algorithm
xroche 88607e8
[Clang][test] Strengthen P3 and P17 to catch in-place-write regression
xroche 2dd4ce8
Merge branch 'main' into musttail-byval-temp-fix
xroche a27213a
Merge branch 'main' into musttail-byval-temp-fix
xroche d12920e
[Clang] Diagnose musttail Indirect args with no addressable source
xroche 7231b68
Merge remote-tracking branch 'origin/main' into musttail-byval-temp-fix
xroche f008bf5
[Clang][test] Make musttail-indirect-arg scratch checks SROA-robust
xroche 1248313
Merge remote-tracking branch 'origin/main' into musttail-byval-temp-fix
xroche 40a7edf
Merge branch 'main' into musttail-byval-temp-fix
xroche 6964a03
Merge branch 'main' into musttail-byval-temp-fix
xroche 3a58836
[Clang][test] Pin slot operands and swap data-flow in musttail-indire…
xroche 6f56dba
[Clang] Drop redundant freeze of forwarded musttail Indirect pointer
xroche cb7efcb
[Clang] Forward trivially-copyable by-value args beyond musttail
xroche 3a8db70
[Clang][test] Cover musttail Indirect arg with no in-memory source
xroche 2a770e5
[Clang] Exclude CUDA surface/texture types from by-value arg forwarding
xroche 5be3d32
[Clang] Exclude ObjC GC object-member records from by-value arg forwa…
xroche 9905d11
Merge remote-tracking branch 'origin/main' into musttail-byval-temp-fix
xroche 8c5c3be
[Clang] Re-gate trivial-copy arg forwarding to musttail calls
xroche beda9ba
[Clang] Accept any same-type glvalue as musttail forwarding source
xroche d6fe44f
[Clang][test] Note the unsupported musttail Indirect case is liftable
xroche c3ba863
[Clang] Restrict musttail forwarding sources to pure lvalue chains
xroche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // RUN: %clang_cc1 -triple=x86_64-linux-gnu -verify -emit-llvm-only %s | ||
| // RUN: %clang_cc1 -triple=riscv64-linux-gnu -verify -emit-llvm-only %s | ||
|
|
||
| // A musttail Indirect argument is forwarded through the matching incoming | ||
| // parameter, which requires an in-memory source. A wide _BitInt has scalar | ||
| // evaluation kind, so the argument is a scalar value with no source storage | ||
| // to forward, regardless of value category. Such a call is rejected rather | ||
| // than routed through a caller-frame temp that dangles past the tail call. | ||
|
xroche marked this conversation as resolved.
|
||
| // This is an implementation limit, not a fundamental one: it could be lifted | ||
| // by storing the value through the incoming parameter's own slot. | ||
|
|
||
| typedef _BitInt(256) BI; | ||
| BI cee(BI x); | ||
| BI pee(BI a) { | ||
| // expected-error@+1 {{'musttail' call requires passing an argument by reference, but the source does not have an addressable storage and would alias the caller's frame}} | ||
| __attribute__((musttail)) return cee(a); | ||
| } | ||
|
|
||
| // An aggregate lvalue has addressable storage to forward, so it is accepted. | ||
| // Confirms the diagnostic is specific to the no-source case. | ||
| struct Big { | ||
| unsigned long long a, b, c, d; | ||
| }; | ||
| struct Big cee_ok(struct Big x); | ||
| struct Big pee_ok(struct Big a) { | ||
| __attribute__((musttail)) return cee_ok(a); | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.