[PATCH] D31846: [coroutines] Handle spills before catchswitch

Gor Nishanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 17:26:25 PDT 2017


GorNishanov added inline comments.


================
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 =
----------------
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.


https://reviews.llvm.org/D31846





More information about the llvm-commits mailing list