Move findBBwithCalls to the file it's used in to avoid unused function

warnings.

llvm-svn: 368636
This commit is contained in:
Eric Christopher 2019-08-13 00:05:01 +00:00
parent b2cff5e50f
commit 4acb4ee767
2 changed files with 24 additions and 24 deletions

View File

@ -18,30 +18,6 @@
#include <vector>
namespace {
using namespace llvm;
std::vector<const BasicBlock *> findBBwithCalls(const Function &F,
bool IndirectCall = false) {
std::vector<const BasicBlock *> BBs;
auto findCallInst = [&IndirectCall](const Instruction &I) {
if (auto Call = dyn_cast<CallBase>(&I)) {
if (Call->isIndirectCall())
return IndirectCall;
else
return true;
} else
return false;
};
for (auto &BB : F)
if (findCallInst(*BB.getTerminator()) ||
llvm::any_of(BB.instructionsWithoutDebug(), findCallInst))
BBs.emplace_back(&BB);
return BBs;
}
} // namespace
namespace llvm {
namespace orc {

View File

@ -12,6 +12,30 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
namespace {
using namespace llvm;
std::vector<const BasicBlock *> findBBwithCalls(const Function &F,
bool IndirectCall = false) {
std::vector<const BasicBlock *> BBs;
auto findCallInst = [&IndirectCall](const Instruction &I) {
if (auto Call = dyn_cast<CallBase>(&I)) {
if (Call->isIndirectCall())
return IndirectCall;
else
return true;
} else
return false;
};
for (auto &BB : F)
if (findCallInst(*BB.getTerminator()) ||
llvm::any_of(BB.instructionsWithoutDebug(), findCallInst))
BBs.emplace_back(&BB);
return BBs;
}
} // namespace
// Implementations of Queries shouldn't need to lock the resources
// such as LLVMContext, each argument (function) has a non-shared LLVMContext
namespace llvm {