[PATCH] D23844: [Coroutines] Part 9: Add cleanup subfunction.

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 28 22:05:33 PDT 2016


majnemer accepted this revision.
majnemer added a comment.
This revision is now accepted and ready to land.

LGTM


================
Comment at: lib/Transforms/Coroutines/CoroElide.cpp:143-156
@@ -149,2 +142,16 @@
 }
 
+// This function is used to check whether a terminator causes control flow to
+// leaves the function in some way.
+static bool returnsOrUnwindsToCaller(TerminatorInst *T) {
+  if (isa<ReturnInst>(T) || isa<ResumeInst>(T))
+    return true;
+
+  if (auto *CR = dyn_cast<CleanupReturnInst>(T))
+    return CR->unwindsToCaller();
+  if (auto *CS = dyn_cast<CatchSwitchInst>(T))
+    return CS->unwindsToCaller();
+
+  return false;
+}
+
----------------
This seems dead.

================
Comment at: lib/Transforms/Coroutines/CoroElide.cpp:171
@@ +170,3 @@
+
+  for (CoroSubFnInst* DA : DestroyAddr) {
+    if (auto *CB = dyn_cast<CoroBeginInst>(DA->getFrame()))
----------------
Pointers lean right.


https://reviews.llvm.org/D23844





More information about the llvm-commits mailing list