[PATCH] D22998: [coroutines] Part 4a: Coroutine Devirtualization: Lower coro.resume and coro.destroy.

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 12:44:04 PDT 2016


majnemer added inline comments.

================
Comment at: include/llvm/IR/CallSite.h:116
@@ +115,3 @@
+  Intrinsic::ID getIntrinsicID() const {
+    if (auto* F = getCalledFunction())
+      return F->getIntrinsicID();
----------------
Pointers lean right.

================
Comment at: lib/Transforms/Coroutines/CoroInstr.h:32
@@ +31,3 @@
+/// This represents the llvm.coro.resume instruction.
+class LLVM_LIBRARY_VISIBILITY CoroResumeInst : public IntrinsicInst {
+public:
----------------
Hmm, this looks like trouble.  CoroResumeInst is an IntrinsicInst but llvm.coro.resume is marked as Throws and IntrinsicInst derives from CallInst.

I think the right thing to do here is to make a helper function... Something like `getIntrinsicCallSite` which takes the intrinsic id (maybe as a template parameter? maybe not?) and returns an empty CallSite if there is no match or a populated CallSite if there was a match.

================
Comment at: lib/Transforms/Coroutines/CoroInstr.h:45
@@ +44,3 @@
+/// This represents the llvm.coro.destroy instruction.
+class LLVM_LIBRARY_VISIBILITY CoroDestroyInst : public IntrinsicInst {
+public:
----------------
Ditto.


https://reviews.llvm.org/D22998





More information about the llvm-commits mailing list