aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SafeStack.cpp
diff options
context:
space:
mode:
authorMircea Trofin <mtrofin@mtrofin-macbookpro3.roam.corp.google.com>2020-04-13 16:39:52 -0700
committerMircea Trofin <mtrofin@google.com>2020-04-13 21:28:58 -0700
commit4aae4e3f48b9156755c4cfc7ad63fe2a7029d9d7 (patch)
tree546245e7e821dcbf42cf636076f5fa663a7b2ff9 /llvm/lib/CodeGen/SafeStack.cpp
parent0a54887dac42531cfaa1ad63d9f664b23aa5eaab (diff)
downloadllvm-4aae4e3f48b9156755c4cfc7ad63fe2a7029d9d7.zip
llvm-4aae4e3f48b9156755c4cfc7ad63fe2a7029d9d7.tar.gz
llvm-4aae4e3f48b9156755c4cfc7ad63fe2a7029d9d7.tar.bz2
[llvm][NFC] CallSite removal from inliner-related files
Summary: This removes CallSite from inliner files. Some dependencies where thus affected. Reviewers: dblaikie, davidxl, craig.topper Subscribers: arsenm, jvesely, nhaehnle, eraman, hiraditya, aheejin, kerbowa, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77991
Diffstat (limited to 'llvm/lib/CodeGen/SafeStack.cpp')
-rw-r--r--llvm/lib/CodeGen/SafeStack.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp
index 8808d90..001df8b 100644
--- a/llvm/lib/CodeGen/SafeStack.cpp
+++ b/llvm/lib/CodeGen/SafeStack.cpp
@@ -33,7 +33,6 @@
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
-#include "llvm/IR/CallSite.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DIBuilder.h"
@@ -200,7 +199,7 @@ class SafeStack {
bool IsAccessSafe(Value *Addr, uint64_t Size, const Value *AllocaPtr,
uint64_t AllocaSize);
- bool ShouldInlinePointerAddress(CallSite &CS);
+ bool ShouldInlinePointerAddress(CallInst &CI);
void TryInlinePointerAddress();
public:
@@ -322,7 +321,7 @@ bool SafeStack::IsSafeStackAlloca(const Value *AllocaPtr, uint64_t AllocaSize) {
case Instruction::Call:
case Instruction::Invoke: {
- ImmutableCallSite CS(I);
+ const CallBase &CS = *cast<CallBase>(I);
if (I->isLifetimeStartOrEnd())
continue;
@@ -344,8 +343,8 @@ bool SafeStack::IsSafeStackAlloca(const Value *AllocaPtr, uint64_t AllocaSize) {
// FIXME: a more precise solution would require an interprocedural
// analysis here, which would look at all uses of an argument inside
// the function being called.
- ImmutableCallSite::arg_iterator B = CS.arg_begin(), E = CS.arg_end();
- for (ImmutableCallSite::arg_iterator A = B; A != E; ++A)
+ auto B = CS.arg_begin(), E = CS.arg_end();
+ for (auto A = B; A != E; ++A)
if (A->get() == V)
if (!(CS.doesNotCapture(A - B) && (CS.doesNotAccessMemory(A - B) ||
CS.doesNotAccessMemory()))) {
@@ -705,34 +704,34 @@ void SafeStack::moveDynamicAllocasToUnsafeStack(
}
}
-bool SafeStack::ShouldInlinePointerAddress(CallSite &CS) {
- Function *Callee = CS.getCalledFunction();
- if (CS.hasFnAttr(Attribute::AlwaysInline) &&
+bool SafeStack::ShouldInlinePointerAddress(CallInst &CI) {
+ Function *Callee = CI.getCalledFunction();
+ if (CI.hasFnAttr(Attribute::AlwaysInline) &&
isInlineViable(*Callee).isSuccess())
return true;
if (Callee->isInterposable() || Callee->hasFnAttribute(Attribute::NoInline) ||
- CS.isNoInline())
+ CI.isNoInline())
return false;
return true;
}
void SafeStack::TryInlinePointerAddress() {
- if (!isa<CallInst>(UnsafeStackPtr))
+ auto *CI = dyn_cast<CallInst>(UnsafeStackPtr);
+ if (!CI)
return;
if(F.hasOptNone())
return;
- CallSite CS(UnsafeStackPtr);
- Function *Callee = CS.getCalledFunction();
+ Function *Callee = CI->getCalledFunction();
if (!Callee || Callee->isDeclaration())
return;
- if (!ShouldInlinePointerAddress(CS))
+ if (!ShouldInlinePointerAddress(*CI))
return;
InlineFunctionInfo IFI;
- InlineFunction(CS, IFI);
+ InlineFunction(*CI, IFI);
}
bool SafeStack::run() {