diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-07-12 21:13:44 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-07-12 21:13:44 +0000 |
commit | 1e44b5d3abc7b8180d2479c39faadf507693401d (patch) | |
tree | 22cac8a6c9e99273cb852288ffa9547138ac49cf /llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h | |
parent | b43bb6141e6826888620204ea579738bd9b02539 (diff) | |
download | bcm5719-llvm-1e44b5d3abc7b8180d2479c39faadf507693401d.tar.gz bcm5719-llvm-1e44b5d3abc7b8180d2479c39faadf507693401d.zip |
Refactor indirect call promotion profitability analysis (NFC)
Summary:
Refactored the profitability analysis out of the IC promotion pass and
into lib/Analysis so that it can be accessed by the summary index
builder in a follow-on patch to enable IC promotion in ThinLTO (D21932).
Reviewers: davidxl, xur
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D22182
llvm-svn: 275216
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h b/llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h deleted file mode 100644 index 71a8cb88632..00000000000 --- a/llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h +++ /dev/null @@ -1,43 +0,0 @@ -//===-- IndirectCallSiteVisitor.h - indirect call-sites visitor -----------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements defines a visitor class and a helper function that find -// all indirect call-sites in a function. - -#include "llvm/IR/InstVisitor.h" -#include <vector> - -namespace llvm { -// Visitor class that finds all indirect call sites. -struct PGOIndirectCallSiteVisitor - : public InstVisitor<PGOIndirectCallSiteVisitor> { - std::vector<Instruction *> IndirectCallInsts; - PGOIndirectCallSiteVisitor() {} - - void visitCallSite(CallSite CS) { - if (CS.getCalledFunction() || !CS.getCalledValue()) - return; - Instruction *I = CS.getInstruction(); - if (CallInst *CI = dyn_cast<CallInst>(I)) { - if (CI->isInlineAsm()) - return; - } - if (isa<Constant>(CS.getCalledValue())) - return; - IndirectCallInsts.push_back(I); - } -}; - -// Helper function that finds all indirect call sites. -static inline std::vector<Instruction *> findIndirectCallSites(Function &F) { - PGOIndirectCallSiteVisitor ICV; - ICV.visit(F); - return ICV.IndirectCallInsts; -} -} |