aboutsummaryrefslogtreecommitdiff
path: root/lib/IR/Statepoint.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IR/Statepoint.cpp')
-rw-r--r--lib/IR/Statepoint.cpp37
1 files changed, 14 insertions, 23 deletions
diff --git a/lib/IR/Statepoint.cpp b/lib/IR/Statepoint.cpp
index 18efee2177c3..fce89b42e9bf 100644
--- a/lib/IR/Statepoint.cpp
+++ b/lib/IR/Statepoint.cpp
@@ -1,9 +1,8 @@
//===-- IR/Statepoint.cpp -- gc.statepoint utilities --- -----------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -18,21 +17,15 @@
using namespace llvm;
-static const Function *getCalledFunction(ImmutableCallSite CS) {
- if (!CS.getInstruction())
- return nullptr;
- return CS.getCalledFunction();
-}
-
-bool llvm::isStatepoint(ImmutableCallSite CS) {
- if (auto *F = getCalledFunction(CS))
+bool llvm::isStatepoint(const CallBase *Call) {
+ if (auto *F = Call->getCalledFunction())
return F->getIntrinsicID() == Intrinsic::experimental_gc_statepoint;
return false;
}
bool llvm::isStatepoint(const Value *V) {
- if (auto CS = ImmutableCallSite(V))
- return isStatepoint(CS);
+ if (auto *Call = dyn_cast<CallBase>(V))
+ return isStatepoint(Call);
return false;
}
@@ -40,23 +33,21 @@ bool llvm::isStatepoint(const Value &V) {
return isStatepoint(&V);
}
-bool llvm::isGCRelocate(ImmutableCallSite CS) {
- return CS.getInstruction() && isa<GCRelocateInst>(CS.getInstruction());
+bool llvm::isGCRelocate(const CallBase *Call) {
+ return isa<GCRelocateInst>(Call);
}
bool llvm::isGCRelocate(const Value *V) {
- if (auto CS = ImmutableCallSite(V))
- return isGCRelocate(CS);
+ if (auto *Call = dyn_cast<CallBase>(V))
+ return isGCRelocate(Call);
return false;
}
-bool llvm::isGCResult(ImmutableCallSite CS) {
- return CS.getInstruction() && isa<GCResultInst>(CS.getInstruction());
-}
+bool llvm::isGCResult(const CallBase *Call) { return isa<GCResultInst>(Call); }
bool llvm::isGCResult(const Value *V) {
- if (auto CS = ImmutableCallSite(V))
- return isGCResult(CS);
+ if (auto *Call = dyn_cast<CallBase>(V))
+ return isGCResult(Call);
return false;
}