Implement support for `become` and explicit tail call codegen for the LLVM backend by xacrimon · Pull Request #144232 · rust-lang/rust

@rustbot rustbot added A-LLVM

Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

labels

Jul 20, 2025

@rustbot rustbot added the S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

label

Jul 21, 2025

tmiasko

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Jul 21, 2025

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Jul 30, 2025

Zalathar added a commit to Zalathar/rust that referenced this pull request

Jul 31, 2025
…fleLapkin

Implement support for `become` and explicit tail call codegen for the LLVM backend

This PR implements codegen of explicit tail calls via `become` in `rustc_codegen_ssa` and support within the LLVM backend. Completes a task on (rust-lang#112788). This PR implements all the necessary bits to make explicit tail calls usable, other backends have received stubs for now and will ICE if you use `become` on them. I suspect there is some bikeshedding to be done on how we should go about implementing this for other backends, but it should be relatively straightforward for GCC after this is merged.

During development I also put together a POC bytecode VM based on tail call dispatch to test these changes out and analyze the codegen to make sure it generates expected assembly. That is available [here](https://github.com/xacrimon/tcvm).

bors added a commit that referenced this pull request

Jul 31, 2025
Rollup of 6 pull requests

Successful merges:

 - #135975 (Implement `push_mut`)
 - #143672 (Fix Box allocator drop elaboration)
 - #144232 (Implement support for `become` and explicit tail call codegen for the LLVM backend)
 - #144663 (coverage: Re-land "Enlarge empty spans during MIR instrumentation")
 - #144683 (Simplify library dependencies on `compiler-builtins`)
 - #144685 (Only extract lang items once in codegen_fn_attrs)

r? `@ghost`
`@rustbot` modify labels: rollup

bors added a commit that referenced this pull request

Jul 31, 2025
Rollup of 6 pull requests

Successful merges:

 - #135975 (Implement `push_mut`)
 - #143672 (Fix Box allocator drop elaboration)
 - #144232 (Implement support for `become` and explicit tail call codegen for the LLVM backend)
 - #144663 (coverage: Re-land "Enlarge empty spans during MIR instrumentation")
 - #144685 (Only extract lang items once in codegen_fn_attrs)
 - #144717 (Move `rustc_middle::parameterized`)

r? `@ghost`
`@rustbot` modify labels: rollup

rust-timer added a commit that referenced this pull request

Jul 31, 2025
Rollup merge of #144232 - xacrimon:explicit-tail-call, r=WaffleLapkin

Implement support for `become` and explicit tail call codegen for the LLVM backend

This PR implements codegen of explicit tail calls via `become` in `rustc_codegen_ssa` and support within the LLVM backend. Completes a task on (#112788). This PR implements all the necessary bits to make explicit tail calls usable, other backends have received stubs for now and will ICE if you use `become` on them. I suspect there is some bikeshedding to be done on how we should go about implementing this for other backends, but it should be relatively straightforward for GCC after this is merged.

During development I also put together a POC bytecode VM based on tail call dispatch to test these changes out and analyze the codegen to make sure it generates expected assembly. That is available [here](https://github.com/xacrimon/tcvm).

@tnuha tnuha mentioned this pull request

Aug 3, 2025

samueltardieu added a commit to samueltardieu/rust that referenced this pull request

Aug 3, 2025
…ffleLapkin

Additional tce tests

r? `@oli-obk`

Adds known-bug tests for LLVM emissions regarding indirect operands for TCE. Also includes a test, `indexer.rs`, referring to function_table behavior described by the RFC.

Depends on rust-lang#144232

Closes rust-lang#144293

samueltardieu added a commit to samueltardieu/rust that referenced this pull request

Aug 3, 2025
…ffleLapkin

Additional tce tests

r? ``@oli-obk``

Adds known-bug tests for LLVM emissions regarding indirect operands for TCE. Also includes a test, `indexer.rs`, referring to function_table behavior described by the RFC.

Depends on rust-lang#144232

Closes rust-lang#144293

GuillaumeGomez pushed a commit to GuillaumeGomez/rust that referenced this pull request

Aug 4, 2025
…fleLapkin

Implement support for `become` and explicit tail call codegen for the LLVM backend

This PR implements codegen of explicit tail calls via `become` in `rustc_codegen_ssa` and support within the LLVM backend. Completes a task on (rust-lang#112788). This PR implements all the necessary bits to make explicit tail calls usable, other backends have received stubs for now and will ICE if you use `become` on them. I suspect there is some bikeshedding to be done on how we should go about implementing this for other backends, but it should be relatively straightforward for GCC after this is merged.

During development I also put together a POC bytecode VM based on tail call dispatch to test these changes out and analyze the codegen to make sure it generates expected assembly. That is available [here](https://github.com/xacrimon/tcvm).

tgross35 added a commit to tgross35/rust that referenced this pull request

Aug 6, 2025
…ffleLapkin

Additional tce tests

r? ``@oli-obk``

Adds known-bug tests for LLVM emissions regarding indirect operands for TCE. Also includes a test, `indexer.rs`, referring to function_table behavior described by the RFC.

Depends on rust-lang#144232

Closes rust-lang#144293

L0uisc

Zalathar added a commit to Zalathar/rust that referenced this pull request

Aug 7, 2025
…ffleLapkin,tgross35

Additional tce tests

r? `@oli-obk`

Adds known-bug tests for LLVM emissions regarding indirect operands for TCE. Also includes a test, `indexer.rs`, referring to function_table behavior described by the RFC.

Depends on rust-lang#144232

Closes rust-lang#144293

rust-timer added a commit that referenced this pull request

Aug 7, 2025
Rollup merge of #144650 - Borgerr:additional-tce-tests, r=WaffleLapkin,tgross35

Additional tce tests

r? `@oli-obk`

Adds known-bug tests for LLVM emissions regarding indirect operands for TCE. Also includes a test, `indexer.rs`, referring to function_table behavior described by the RFC.

Depends on #144232

Closes #144293

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request

Aug 8, 2025
…n,tgross35

Additional tce tests

r? `@oli-obk`

Adds known-bug tests for LLVM emissions regarding indirect operands for TCE. Also includes a test, `indexer.rs`, referring to function_table behavior described by the RFC.

Depends on rust-lang/rust#144232

Closes rust-lang/rust#144293

github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request

Aug 11, 2025
…n,tgross35

Additional tce tests

r? `@oli-obk`

Adds known-bug tests for LLVM emissions regarding indirect operands for TCE. Also includes a test, `indexer.rs`, referring to function_table behavior described by the RFC.

Depends on rust-lang/rust#144232

Closes rust-lang/rust#144293

github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request

Aug 18, 2025
…n,tgross35

Additional tce tests

r? `@oli-obk`

Adds known-bug tests for LLVM emissions regarding indirect operands for TCE. Also includes a test, `indexer.rs`, referring to function_table behavior described by the RFC.

Depends on rust-lang/rust#144232

Closes rust-lang/rust#144293

Kobzol pushed a commit to Kobzol/rustc_codegen_gcc that referenced this pull request

Dec 21, 2025

Kobzol pushed a commit to Kobzol/rustc_codegen_gcc that referenced this pull request

Dec 21, 2025
…n,tgross35

Additional tce tests

r? `@oli-obk`

Adds known-bug tests for LLVM emissions regarding indirect operands for TCE. Also includes a test, `indexer.rs`, referring to function_table behavior described by the RFC.

Depends on rust-lang/rust#144232

Closes rust-lang/rust#144293