[llvm] [SCCP] Do not track returns from pre-split coroutines (PR #227232)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 02:56:47 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Karim Alweheshy (karim-alweheshy)
<details>
<summary>Changes</summary>
## Summary
Before coroutine splitting, a returned-continuation coroutine can end in `llvm.coro.end` and `unreachable` rather than an ordinary `ret`. IPSCCP currently tracks its return value anyway. When it sees no `ret`, it can replace a direct call's returned continuation/yield-pointer pair with `undef`; coroutine splitting later creates a concrete return, but the caller has already lost the value.
Exclude `presplitcoroutine` functions from interprocedural return tracking. This also keeps the related called-value propagation analysis from making the same assumption. Argument tracking and other IPO optimizations remain available.
## Test
The new IR regression test models a returned-continuation coroutine and a direct/indirect call join. It fails on unpatched LLVM because the direct incoming pair becomes `undef`, and passes with this change. It also verifies that coroutine splitting creates a concrete pair and that return propagation for an ordinary function is unchanged.
Validated with a locally built `opt` and both `RUN` pipelines. Broader integration testing is in progress.
---
Full diff: https://github.com/llvm/llvm-project/pull/227232.diff
2 Files Affected:
- (modified) llvm/lib/Analysis/ValueLatticeUtils.cpp (+7-1)
- (added) llvm/test/Transforms/SCCP/ipsccp-presplit-coroutine.ll (+82)
``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````
</details>
https://github.com/llvm/llvm-project/pull/227232
More information about the llvm-commits
mailing list