Simply, before this patch, following command would fail:
clang -emit-llvm -c -O3 -Xclang -disable-llvm-passes \ clang/test/CodeGenCoroutines/coro-symmetric-transfer-01.cpp \ -std=c++20 -o coro.bc clang -c coro.bc
First, I think it should be a defect that we need to fix. Since the IR generated by disable-llvm-passes should be valid IR and should be valid input to clang.
Then I think there would be two options:
- Add an option in clang like the option -enable-coroutines in opt.
- Make coroutine passes run by default in LLVM pipeline.
This patch implements the second methods. On the one hand, the coroutine passes seems to be stable since there are already many projects using coroutine feature. On the other hand, the coroutine passes should do nothing for IR who doesn't contain coroutine intrinsic.
So I think it should be OK to turn coroutine passes by default.
Test Plan: check-llvm