[PATCH] D31846: [coroutines] Handle spills before catchswitch
David Majnemer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 10 17:30:47 PDT 2017
majnemer accepted this revision.
majnemer added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: lib/Transforms/Coroutines/CoroFrame.cpp:360-368
+ BasicBlock *CurrentBlock = CatchSwitch->getParent();
+ BasicBlock *NewBlock = CurrentBlock->splitBasicBlock(CatchSwitch);
+ CurrentBlock->getTerminator()->eraseFromParent();
+
+ auto *CleanupPad =
+ CleanupPadInst::Create(CatchSwitch->getParentPad(), {}, "", CurrentBlock);
+ auto *CleanupRet =
----------------
GorNishanov wrote:
> majnemer wrote:
> > What if the catchswitch had a phi on it? You are adding a predecessor which would mean it needs new entries.
> Not sure I understand.
>
> PHIs are staying in place. The purpose of this change is to break the catchswitch away from its PHIs, so that we have room to insert spills. The catchswitch goes into a new block and refers to the original PHIs as before.
Ah, I understand now.
https://reviews.llvm.org/D31846
More information about the llvm-commits
mailing list