[PATCH] D105877: [Coroutines] Run coroutine passes by default

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 01:21:32 PDT 2021


ChuanqiXu created this revision.
ChuanqiXu added reviewers: lxfind, rjmccall, aeubanks, dblaikie.
Herald added subscribers: ormris, wenlei, steven_wu, hiraditya.
ChuanqiXu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Background: https://groups.google.com/g/llvm-dev/c/_Np-EWe662Q

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


https://reviews.llvm.org/D105877

Files:
  clang/test/CodeGen/lto-newpm-pipeline.c
  clang/test/CodeGenCoroutines/coro-always-inline.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/test/Other/new-pm-O0-defaults.ll
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105877.358183.patch
Type: text/x-patch
Size: 16717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210713/3a945d4e/attachment.bin>


More information about the llvm-commits mailing list