From 035c5fe3c92a4c2de1d83d0e363d46d673f62daf Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 11 Feb 2019 09:03:32 +0000 Subject: [PATCH] Remove `CallSite` from the CodeMetrics analysis, moving it to the new `CallBase` and simpler APIs therein. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353673 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/CodeMetrics.h | 1 - lib/Analysis/CodeMetrics.cpp | 11 ++++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/llvm/Analysis/CodeMetrics.h b/include/llvm/Analysis/CodeMetrics.h index f6ce2cdbee6..1482b66a308 100644 --- a/include/llvm/Analysis/CodeMetrics.h +++ b/include/llvm/Analysis/CodeMetrics.h @@ -16,7 +16,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" -#include "llvm/IR/CallSite.h" namespace llvm { class AssumptionCache; diff --git a/lib/Analysis/CodeMetrics.cpp b/lib/Analysis/CodeMetrics.cpp index 5133192c152..627d955c865 100644 --- a/lib/Analysis/CodeMetrics.cpp +++ b/lib/Analysis/CodeMetrics.cpp @@ -15,7 +15,6 @@ #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Analysis/ValueTracking.h" -#include "llvm/IR/CallSite.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Function.h" #include "llvm/Support/Debug.h" @@ -125,14 +124,12 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB, continue; // Special handling for calls. - if (isa(I) || isa(I)) { - ImmutableCallSite CS(&I); - - if (const Function *F = CS.getCalledFunction()) { + if (const auto *Call = dyn_cast(&I)) { + if (const Function *F = Call->getCalledFunction()) { // If a function is both internal and has a single use, then it is // extremely likely to get inlined in the future (it was probably // exposed by an interleaved devirtualization pass). - if (!CS.isNoInline() && F->hasInternalLinkage() && F->hasOneUse()) + if (!Call->isNoInline() && F->hasInternalLinkage() && F->hasOneUse()) ++NumInlineCandidates; // If this call is to function itself, then the function is recursive. @@ -147,7 +144,7 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB, } else { // We don't want inline asm to count as a call - that would prevent loop // unrolling. The argument setup cost is still real, though. - if (!isa(CS.getCalledValue())) + if (!Call->isInlineAsm()) ++NumCalls; } } -- 2.50.1