From c720b8690d78e2f1685495893211ed354f3cda9f Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Thu, 2 Jul 2015 02:53:34 +0000 Subject: [PATCH] [Statepoints][NFC] Add Statepoint::getGCResult. Summary: Introduce a simple accessor to get the gc_result hanging off of a statepoint. (I don't think this change needs review, this was uploaded to phabricator to provide context for later dependent changes.) Differential Revision: http://reviews.llvm.org/D10627 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241231 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/Statepoint.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/llvm/IR/Statepoint.h b/include/llvm/IR/Statepoint.h index f5f562308ed..4e6fb4171a3 100644 --- a/include/llvm/IR/Statepoint.h +++ b/include/llvm/IR/Statepoint.h @@ -200,6 +200,17 @@ public: /// path of invoke. std::vector getRelocates(); + /// Get the experimental_gc_result call tied to this statepoint. Can be + /// nullptr if there isn't a gc_result tied to this statepoint. Guaranteed to + /// be a CallInst if non-null. + InstructionTy *getGCResult() { + for (auto *U : getCallSite().getInstruction()->users()) + if (isGCResult(U)) + return cast(U); + + return nullptr; + } + #ifndef NDEBUG /// Asserts if this statepoint is malformed. Common cases for failure /// include incorrect length prefixes for variable length sections or -- 2.34.1