[PATCH] D71902: [Coroutines][5/6] Support 'opt -passes=coroutines'

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 26 06:31:11 PST 2019


modocache created this revision.
modocache added reviewers: GorNishanov, lewissbaker, chandlerc, junparser.
Herald added subscribers: hiraditya, Prazek, EricWF.
Herald added a project: LLVM.

Depends on https://reviews.llvm.org/D71901.

The fifth in a series of patches that ports the LLVM coroutines passes
to the new pass manager infrastructure.

The first 4 patches allow users to run coroutine passes by invoking, for
example `opt -passes=coro-early`. However, most of LLVM's tests for
coroutines use an option, `opt -enable-coroutines`, which adds all 4
coroutines passes, in the correct order, to the legacy pass manager's pass
pipeline. This patch adds a similar feature, but in a way that can be used
by the new pass manager: a pipeline parser that understands
`opt -passes=coroutines`.

When used, this option schedules the passes 'coro-early', 'coro-split',
'coro-elide', 'coro-split', and 'coro-cleanup'.

Noteworthy here is that, in the old pass manager infrastructure, an indirect
call added by the 'coro-split' pass is then devirtualized by 'coro-elide',
and this would cause a restart of the CGSCC pass pipeline. The new pass
manager's CGSCC pass manager, on the other hand, does not check for
new and devirtualized function calls at the same intervals. Even using
the `DevirtSCCRepeatedPass` to wrap 'coro-split' and 'coro-elide', the check
for a devirtualized function would not detect a function added in the
first pass 'coro-split' and devirtualized in the second, 'coro-elide'.
So for now, this patch manually schedules iterations 1 and 2 of
'coro-split'.

Also worth mentioning: many of the coroutines regression tests check the
optimizations that occur with `opt -O2 -enable-coroutines`. With the new
pass manager, the opt driver does not honor arguments like `-O2`, which
add any number of passes. Instead, tests would need to list out passes
explicitly. I'm leaving that up to future passes, and for now, only
tests for `opt -O0 -enable-coroutines` have been modified to also test
the new pass manager.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71902

Files:
  llvm/include/llvm/Transforms/Coroutines.h
  llvm/lib/Transforms/Coroutines/Coroutines.cpp
  llvm/test/Transforms/Coroutines/coro-cleanup.ll
  llvm/test/Transforms/Coroutines/restart-trigger.ll
  llvm/test/Transforms/Coroutines/smoketest.ll
  llvm/tools/opt/NewPMDriver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71902.235343.patch
Type: text/x-patch
Size: 5346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191226/aab0af1a/attachment.bin>


More information about the llvm-commits mailing list