[llvm] [Coroutines] Don't assert if coro-early runs more than once (PR #134854)
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 9 05:40:00 PDT 2025
zmodem wrote:
The question is how to update the pipelines. From the bug, clang was run like this:
```
$ build/bin/clang -std=c++20 -O2 -flto=thin -c /tmp/a.cc -o /tmp/a.o.bc
$ build/bin/clang -c -x ir /tmp/a.o.bc
```
In the first invocation, we add the CoroEarly pass via `buildThinLTOPreLinkDefaultPipeline()` -> `buildModuleSimplificationPipeline()`. This makes sense: we want the pass to run early.
For the second invocation, we add it via `buildPerModuleDefaultPipeline()` -> `buildO0DefaultPipeline()` -> `buildCoroWrapper()`. The last one has a TODO about checking the LTO phase. But in this case, the phase is `ThinOrFullLTOPhase::None`, since we decided to skip LTO and just go straight to codegen (maybe because we're building for a unit test or something).
So it's not really clear what the fix would be. Maybe we could introduce another LTO phase for this case, but that would add some complexity which I'm not sure is worth it.
And in general, I think we want the pass to be robust against running twice. If someone takes that IR and runs it through `opt -O1` for example, we don't want it to assert.
https://github.com/llvm/llvm-project/pull/134854
More information about the llvm-commits
mailing list