[PATCH] D23234: [Coroutines] Part 5: Add CGSCC restart trigger

Gor Nishanov via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 6 06:24:32 PDT 2016


GorNishanov added a comment.

In https://reviews.llvm.org/D23234#507839, @mehdi_amini wrote:

> This seems "hacky", but it is maybe because I don't grasp the complexity of what is achieved here.


I considered three other less hacky alternatives to force a restart of CGSCC pipeline. They all had an unfortunate property of slowing down (slightly) compilation even if the module has no coroutines at all. I found the hacky alternative offered by this patch tolerable because it:

  a) does not affect non-coroutines, thus, no impact on compilation of regular functions
  b) we already have devirtualization logic for coro.resume and coro.destroy and we utilize it as a restart trigger

Less hacky alternatives:

Option 1: make CGPassManager a little bit of coroutine aware.
http://reviews.llvm.org/D21569
I dislike this approach as I’d like to keep Coroutine specific logic in coroutine passes

Option 2: Generalization runOnSCC(SCC, bool& restartRequired) – now any pass can request a restart
http://reviews.llvm.org/D21570
Not sure about this one either, it is very “in your face”. On the other hand, it is very straightforward way of specifying the desired behavior compare to:

Option 3: Add virtual bool CallGraphSCCPass::restartRequested() const; CGManager will call it after each call to runOnSCC to check if restart is required

http://reviews.llvm.org/D21572
Well, I am not sure about this one either. It is slightly more convoluted way to do option 2. 
On the plus side, this is not a breaking change, and also, forcing people to work a little harder to demand restart, may give them a chance to think and realize that may be they don’t need to rerun the pipeline at all.


https://reviews.llvm.org/D23234





More information about the llvm-commits mailing list