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

Gor Nishanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 17:32:16 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:
> 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.
Aah. I understand now. Description was incorrectly stating that we are splitting the PHIs away.
Fixed the description to clarify that we splitting away the catchswitch keeping the PHIs in place.


https://reviews.llvm.org/D31846





More information about the llvm-commits mailing list