summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2019-01-07 07:31:49 +0000
committerChandler Carruth <chandlerc@gmail.com>2019-01-07 07:31:49 +0000
commit90c09232a2e508da54ee67e61dcdc6b507b5b1f9 (patch)
tree5a6319a8876f0d34aa30ca4bfe7892c5b1a64b17 /llvm/lib/IR/Function.cpp
parent57578aaf96129bb2afbb75bc2523aa47fc1aa993 (diff)
downloadbcm5719-llvm-90c09232a2e508da54ee67e61dcdc6b507b5b1f9.tar.gz
bcm5719-llvm-90c09232a2e508da54ee67e61dcdc6b507b5b1f9.zip
[CallSite removal] Move the rest of IR implementation code away from
`CallSite`. With this change, the remaining `CallSite` usages are just for implementing the wrapper type itself. This does update the C API but leaves the names of that API alone and only updates their implementation. Differential Revision: https://reviews.llvm.org/D56184 llvm-svn: 350509
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index ec094812ceb..a88478b89bf 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -24,7 +24,6 @@
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
-#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
@@ -1257,13 +1256,13 @@ bool Function::hasAddressTaken(const User* *PutOffender) const {
const User *FU = U.getUser();
if (isa<BlockAddress>(FU))
continue;
- if (!isa<CallInst>(FU) && !isa<InvokeInst>(FU)) {
+ const auto *Call = dyn_cast<CallBase>(FU);
+ if (!Call) {
if (PutOffender)
*PutOffender = FU;
return true;
}
- ImmutableCallSite CS(cast<Instruction>(FU));
- if (!CS.isCallee(&U)) {
+ if (!Call->isCallee(&U)) {
if (PutOffender)
*PutOffender = FU;
return true;
@@ -1289,12 +1288,10 @@ bool Function::isDefTriviallyDead() const {
/// callsFunctionThatReturnsTwice - Return true if the function has a call to
/// setjmp or other function that gcc recognizes as "returning twice".
bool Function::callsFunctionThatReturnsTwice() const {
- for (const_inst_iterator
- I = inst_begin(this), E = inst_end(this); I != E; ++I) {
- ImmutableCallSite CS(&*I);
- if (CS && CS.hasFnAttr(Attribute::ReturnsTwice))
- return true;
- }
+ for (const Instruction &I : instructions(this))
+ if (const auto *Call = dyn_cast<CallBase>(&I))
+ if (Call->hasFnAttr(Attribute::ReturnsTwice))
+ return true;
return false;
}
OpenPOWER on IntegriCloud