[PATCH] D23117: [coroutines] Part 4b: Coroutine Devirtualization: Handle unwinding coro.resume and coro.destroy.
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 3 08:56:07 PDT 2016
majnemer added inline comments.
================
Comment at: lib/Transforms/Coroutines/CoroEarly.cpp:70-86
@@ +69,19 @@
+
+ auto Inv = dyn_cast<InvokeInst>(&I);
+ if (!Inv)
+ continue;
+ auto CalledFn = Inv->getCalledFunction();
+ if (!CalledFn)
+ continue;
+ StringRef Name = CalledFn->getName();
+ if (!Name.startswith("llvm.coro"))
+ continue;
+ if (Name == CORO_RESUME_STR) {
+ lowerResumeOrDestroy(Inv, CoroSubFnInst::ResumeIndex);
+ } else {
+ assert(Name == CORO_DESTROY_STR && "Cannot invoke coroutine intrinsic "
+ "other than coro.resume and "
+ "coro.destroy");
+ lowerResumeOrDestroy(Inv, CoroSubFnInst::DestroyIndex);
+ }
+ Changed = true;
----------------
Why not throw &I into a `CallSite`? `CallSite` abstracts over `call` and `invoke`.
You would need to add `getIntrinsicID` to `CallSite`.
Repository:
rL LLVM
https://reviews.llvm.org/D23117
More information about the llvm-commits
mailing list