mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[PM] Separate the TargetLibraryInfo object from the immutable pass.
The pass is really just a means of accessing a cached instance of the TargetLibraryInfo object, and this way we can re-use that object for the new pass manager as its result. Lots of delta, but nothing interesting happening here. This is the common pattern that is developing to allow analyses to live in both the old and new pass manager -- a wrapper pass in the old pass manager emulates the separation intrinsic to the new pass manager between the result and pass for analyses. llvm-svn: 226157
This commit is contained in:
parent
d86e76971b
commit
88fd126216
@ -697,8 +697,7 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
/// This both allows optimizations to handle them specially and frontends to
|
/// This both allows optimizations to handle them specially and frontends to
|
||||||
/// disable such optimizations through -fno-builtin etc.
|
/// disable such optimizations through -fno-builtin etc.
|
||||||
class TargetLibraryInfo : public ImmutablePass {
|
class TargetLibraryInfo {
|
||||||
virtual void anchor();
|
|
||||||
unsigned char AvailableArray[(LibFunc::NumLibFuncs+3)/4];
|
unsigned char AvailableArray[(LibFunc::NumLibFuncs+3)/4];
|
||||||
llvm::DenseMap<unsigned, std::string> CustomNames;
|
llvm::DenseMap<unsigned, std::string> CustomNames;
|
||||||
static const char* StandardNames[LibFunc::NumLibFuncs];
|
static const char* StandardNames[LibFunc::NumLibFuncs];
|
||||||
@ -717,9 +716,8 @@ class TargetLibraryInfo : public ImmutablePass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID;
|
|
||||||
TargetLibraryInfo();
|
TargetLibraryInfo();
|
||||||
TargetLibraryInfo(const Triple &T);
|
explicit TargetLibraryInfo(const Triple &T);
|
||||||
explicit TargetLibraryInfo(const TargetLibraryInfo &TLI);
|
explicit TargetLibraryInfo(const TargetLibraryInfo &TLI);
|
||||||
|
|
||||||
/// \brief Searches for a particular function name.
|
/// \brief Searches for a particular function name.
|
||||||
@ -803,6 +801,21 @@ public:
|
|||||||
void disableAllFunctions();
|
void disableAllFunctions();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TargetLibraryInfoWrapperPass : public ImmutablePass {
|
||||||
|
TargetLibraryInfo TLI;
|
||||||
|
|
||||||
|
virtual void anchor();
|
||||||
|
|
||||||
|
public:
|
||||||
|
static char ID;
|
||||||
|
TargetLibraryInfoWrapperPass();
|
||||||
|
explicit TargetLibraryInfoWrapperPass(const Triple &T);
|
||||||
|
explicit TargetLibraryInfoWrapperPass(const TargetLibraryInfo &TLI);
|
||||||
|
|
||||||
|
TargetLibraryInfo &getTLI() { return TLI; }
|
||||||
|
const TargetLibraryInfo &getTLI() const { return TLI; }
|
||||||
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -265,7 +265,7 @@ void initializeDataLayoutPassPass(PassRegistry &);
|
|||||||
void initializeTargetTransformInfoAnalysisGroup(PassRegistry&);
|
void initializeTargetTransformInfoAnalysisGroup(PassRegistry&);
|
||||||
void initializeFunctionTargetTransformInfoPass(PassRegistry &);
|
void initializeFunctionTargetTransformInfoPass(PassRegistry &);
|
||||||
void initializeNoTTIPass(PassRegistry&);
|
void initializeNoTTIPass(PassRegistry&);
|
||||||
void initializeTargetLibraryInfoPass(PassRegistry&);
|
void initializeTargetLibraryInfoWrapperPassPass(PassRegistry &);
|
||||||
void initializeAssumptionCacheTrackerPass(PassRegistry &);
|
void initializeAssumptionCacheTrackerPass(PassRegistry &);
|
||||||
void initializeTwoAddressInstructionPassPass(PassRegistry&);
|
void initializeTwoAddressInstructionPassPass(PassRegistry&);
|
||||||
void initializeTypeBasedAliasAnalysisPass(PassRegistry&);
|
void initializeTypeBasedAliasAnalysisPass(PassRegistry&);
|
||||||
|
@ -465,7 +465,8 @@ AliasAnalysis::~AliasAnalysis() {}
|
|||||||
void AliasAnalysis::InitializeAliasAnalysis(Pass *P) {
|
void AliasAnalysis::InitializeAliasAnalysis(Pass *P) {
|
||||||
DataLayoutPass *DLP = P->getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = P->getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TLI = P->getAnalysisIfAvailable<TargetLibraryInfo>();
|
auto *TLIP = P->getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>();
|
||||||
|
TLI = TLIP ? &TLIP->getTLI() : nullptr;
|
||||||
AA = &P->getAnalysis<AliasAnalysis>();
|
AA = &P->getAnalysis<AliasAnalysis>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ namespace {
|
|||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addRequired<AliasAnalysis>();
|
AU.addRequired<AliasAnalysis>();
|
||||||
AU.addRequired<AssumptionCacheTracker>();
|
AU.addRequired<AssumptionCacheTracker>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
|
|
||||||
AliasResult alias(const Location &LocA, const Location &LocB) override {
|
AliasResult alias(const Location &LocA, const Location &LocB) override {
|
||||||
@ -591,7 +591,7 @@ INITIALIZE_AG_PASS_BEGIN(BasicAliasAnalysis, AliasAnalysis, "basicaa",
|
|||||||
"Basic Alias Analysis (stateless AA impl)",
|
"Basic Alias Analysis (stateless AA impl)",
|
||||||
false, true, false)
|
false, true, false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_AG_PASS_END(BasicAliasAnalysis, AliasAnalysis, "basicaa",
|
INITIALIZE_AG_PASS_END(BasicAliasAnalysis, AliasAnalysis, "basicaa",
|
||||||
"Basic Alias Analysis (stateless AA impl)",
|
"Basic Alias Analysis (stateless AA impl)",
|
||||||
false, true, false)
|
false, true, false)
|
||||||
@ -718,7 +718,8 @@ BasicAliasAnalysis::getModRefBehavior(const Function *F) {
|
|||||||
if (F->onlyReadsMemory())
|
if (F->onlyReadsMemory())
|
||||||
Min = OnlyReadsMemory;
|
Min = OnlyReadsMemory;
|
||||||
|
|
||||||
const TargetLibraryInfo &TLI = getAnalysis<TargetLibraryInfo>();
|
const TargetLibraryInfo &TLI =
|
||||||
|
getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
if (isMemsetPattern16(F, TLI))
|
if (isMemsetPattern16(F, TLI))
|
||||||
Min = OnlyAccessesArgumentPointees;
|
Min = OnlyAccessesArgumentPointees;
|
||||||
|
|
||||||
@ -730,7 +731,8 @@ AliasAnalysis::Location
|
|||||||
BasicAliasAnalysis::getArgLocation(ImmutableCallSite CS, unsigned ArgIdx,
|
BasicAliasAnalysis::getArgLocation(ImmutableCallSite CS, unsigned ArgIdx,
|
||||||
ModRefResult &Mask) {
|
ModRefResult &Mask) {
|
||||||
Location Loc = AliasAnalysis::getArgLocation(CS, ArgIdx, Mask);
|
Location Loc = AliasAnalysis::getArgLocation(CS, ArgIdx, Mask);
|
||||||
const TargetLibraryInfo &TLI = getAnalysis<TargetLibraryInfo>();
|
const TargetLibraryInfo &TLI =
|
||||||
|
getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
const IntrinsicInst *II = dyn_cast<IntrinsicInst>(CS.getInstruction());
|
const IntrinsicInst *II = dyn_cast<IntrinsicInst>(CS.getInstruction());
|
||||||
if (II != nullptr)
|
if (II != nullptr)
|
||||||
switch (II->getIntrinsicID()) {
|
switch (II->getIntrinsicID()) {
|
||||||
|
@ -41,7 +41,7 @@ char LazyValueInfo::ID = 0;
|
|||||||
INITIALIZE_PASS_BEGIN(LazyValueInfo, "lazy-value-info",
|
INITIALIZE_PASS_BEGIN(LazyValueInfo, "lazy-value-info",
|
||||||
"Lazy Value Information Analysis", false, true)
|
"Lazy Value Information Analysis", false, true)
|
||||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(LazyValueInfo, "lazy-value-info",
|
INITIALIZE_PASS_END(LazyValueInfo, "lazy-value-info",
|
||||||
"Lazy Value Information Analysis", false, true)
|
"Lazy Value Information Analysis", false, true)
|
||||||
|
|
||||||
@ -1121,7 +1121,7 @@ bool LazyValueInfo::runOnFunction(Function &F) {
|
|||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
|
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
|
||||||
if (PImpl)
|
if (PImpl)
|
||||||
getCache(PImpl, AC, DL, DT).clear();
|
getCache(PImpl, AC, DL, DT).clear();
|
||||||
@ -1133,7 +1133,7 @@ bool LazyValueInfo::runOnFunction(Function &F) {
|
|||||||
void LazyValueInfo::getAnalysisUsage(AnalysisUsage &AU) const {
|
void LazyValueInfo::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.setPreservesAll();
|
AU.setPreservesAll();
|
||||||
AU.addRequired<AssumptionCacheTracker>();
|
AU.addRequired<AssumptionCacheTracker>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LazyValueInfo::releaseMemory() {
|
void LazyValueInfo::releaseMemory() {
|
||||||
|
@ -121,7 +121,7 @@ namespace {
|
|||||||
AU.setPreservesAll();
|
AU.setPreservesAll();
|
||||||
AU.addRequired<AliasAnalysis>();
|
AU.addRequired<AliasAnalysis>();
|
||||||
AU.addRequired<AssumptionCacheTracker>();
|
AU.addRequired<AssumptionCacheTracker>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
AU.addRequired<DominatorTreeWrapperPass>();
|
AU.addRequired<DominatorTreeWrapperPass>();
|
||||||
}
|
}
|
||||||
void print(raw_ostream &O, const Module *M) const override {}
|
void print(raw_ostream &O, const Module *M) const override {}
|
||||||
@ -155,7 +155,7 @@ char Lint::ID = 0;
|
|||||||
INITIALIZE_PASS_BEGIN(Lint, "lint", "Statically lint-checks LLVM IR",
|
INITIALIZE_PASS_BEGIN(Lint, "lint", "Statically lint-checks LLVM IR",
|
||||||
false, true)
|
false, true)
|
||||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
||||||
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
||||||
INITIALIZE_PASS_END(Lint, "lint", "Statically lint-checks LLVM IR",
|
INITIALIZE_PASS_END(Lint, "lint", "Statically lint-checks LLVM IR",
|
||||||
@ -183,7 +183,7 @@ bool Lint::runOnFunction(Function &F) {
|
|||||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
visit(F);
|
visit(F);
|
||||||
dbgs() << MessagesStr.str();
|
dbgs() << MessagesStr.str();
|
||||||
Messages.clear();
|
Messages.clear();
|
||||||
|
@ -119,7 +119,7 @@ INITIALIZE_PASS_BEGIN(ScalarEvolution, "scalar-evolution",
|
|||||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
||||||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(ScalarEvolution, "scalar-evolution",
|
INITIALIZE_PASS_END(ScalarEvolution, "scalar-evolution",
|
||||||
"Scalar Evolution Analysis", false, true)
|
"Scalar Evolution Analysis", false, true)
|
||||||
char ScalarEvolution::ID = 0;
|
char ScalarEvolution::ID = 0;
|
||||||
@ -7870,7 +7870,7 @@ bool ScalarEvolution::runOnFunction(Function &F) {
|
|||||||
LI = &getAnalysis<LoopInfo>();
|
LI = &getAnalysis<LoopInfo>();
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -7910,7 +7910,7 @@ void ScalarEvolution::getAnalysisUsage(AnalysisUsage &AU) const {
|
|||||||
AU.addRequired<AssumptionCacheTracker>();
|
AU.addRequired<AssumptionCacheTracker>();
|
||||||
AU.addRequiredTransitive<LoopInfo>();
|
AU.addRequiredTransitive<LoopInfo>();
|
||||||
AU.addRequiredTransitive<DominatorTreeWrapperPass>();
|
AU.addRequiredTransitive<DominatorTreeWrapperPass>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScalarEvolution::hasLoopInvariantBackedgeTakenCount(const Loop *L) {
|
bool ScalarEvolution::hasLoopInvariantBackedgeTakenCount(const Loop *L) {
|
||||||
|
@ -15,13 +15,6 @@
|
|||||||
#include "llvm/ADT/Triple.h"
|
#include "llvm/ADT/Triple.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// Register the default implementation.
|
|
||||||
INITIALIZE_PASS(TargetLibraryInfo, "targetlibinfo",
|
|
||||||
"Target Library Information", false, true)
|
|
||||||
char TargetLibraryInfo::ID = 0;
|
|
||||||
|
|
||||||
void TargetLibraryInfo::anchor() { }
|
|
||||||
|
|
||||||
const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] =
|
const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] =
|
||||||
{
|
{
|
||||||
"_IO_getc",
|
"_IO_getc",
|
||||||
@ -379,8 +372,6 @@ static bool hasSinCosPiStret(const Triple &T) {
|
|||||||
/// target triple gets a sane set of defaults.
|
/// target triple gets a sane set of defaults.
|
||||||
static void initialize(TargetLibraryInfo &TLI, const Triple &T,
|
static void initialize(TargetLibraryInfo &TLI, const Triple &T,
|
||||||
const char **StandardNames) {
|
const char **StandardNames) {
|
||||||
initializeTargetLibraryInfoPass(*PassRegistry::getPassRegistry());
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// Verify that the StandardNames array is in alphabetical order.
|
// Verify that the StandardNames array is in alphabetical order.
|
||||||
for (unsigned F = 1; F < LibFunc::NumLibFuncs; ++F) {
|
for (unsigned F = 1; F < LibFunc::NumLibFuncs; ++F) {
|
||||||
@ -685,23 +676,21 @@ static void initialize(TargetLibraryInfo &TLI, const Triple &T,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TargetLibraryInfo::TargetLibraryInfo() {
|
||||||
TargetLibraryInfo::TargetLibraryInfo() : ImmutablePass(ID) {
|
|
||||||
// Default to everything being available.
|
// Default to everything being available.
|
||||||
memset(AvailableArray, -1, sizeof(AvailableArray));
|
memset(AvailableArray, -1, sizeof(AvailableArray));
|
||||||
|
|
||||||
initialize(*this, Triple(), StandardNames);
|
initialize(*this, Triple(), StandardNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetLibraryInfo::TargetLibraryInfo(const Triple &T) : ImmutablePass(ID) {
|
TargetLibraryInfo::TargetLibraryInfo(const Triple &T) {
|
||||||
// Default to everything being available.
|
// Default to everything being available.
|
||||||
memset(AvailableArray, -1, sizeof(AvailableArray));
|
memset(AvailableArray, -1, sizeof(AvailableArray));
|
||||||
|
|
||||||
initialize(*this, T, StandardNames);
|
initialize(*this, T, StandardNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetLibraryInfo::TargetLibraryInfo(const TargetLibraryInfo &TLI)
|
TargetLibraryInfo::TargetLibraryInfo(const TargetLibraryInfo &TLI) {
|
||||||
: ImmutablePass(ID) {
|
|
||||||
memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray));
|
memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray));
|
||||||
CustomNames = TLI.CustomNames;
|
CustomNames = TLI.CustomNames;
|
||||||
}
|
}
|
||||||
@ -747,8 +736,29 @@ bool TargetLibraryInfo::getLibFunc(StringRef funcName,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// disableAllFunctions - This disables all builtins, which is used for options
|
|
||||||
/// like -fno-builtin.
|
|
||||||
void TargetLibraryInfo::disableAllFunctions() {
|
void TargetLibraryInfo::disableAllFunctions() {
|
||||||
memset(AvailableArray, 0, sizeof(AvailableArray));
|
memset(AvailableArray, 0, sizeof(AvailableArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass()
|
||||||
|
: ImmutablePass(ID), TLI() {
|
||||||
|
initializeTargetLibraryInfoWrapperPassPass(*PassRegistry::getPassRegistry());
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass(const Triple &T)
|
||||||
|
: ImmutablePass(ID), TLI(T) {
|
||||||
|
initializeTargetLibraryInfoWrapperPassPass(*PassRegistry::getPassRegistry());
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass(
|
||||||
|
const TargetLibraryInfo &TLI)
|
||||||
|
: ImmutablePass(ID), TLI(TLI) {
|
||||||
|
initializeTargetLibraryInfoWrapperPassPass(*PassRegistry::getPassRegistry());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register the basic pass.
|
||||||
|
INITIALIZE_PASS(TargetLibraryInfoWrapperPass, "targetlibinfo",
|
||||||
|
"Target Library Information", false, true)
|
||||||
|
char TargetLibraryInfoWrapperPass::ID = 0;
|
||||||
|
|
||||||
|
void TargetLibraryInfoWrapperPass::anchor() {}
|
||||||
|
@ -161,7 +161,7 @@ class TypePromotionTransaction;
|
|||||||
|
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addPreserved<DominatorTreeWrapperPass>();
|
AU.addPreserved<DominatorTreeWrapperPass>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
AU.addRequired<TargetTransformInfo>();
|
AU.addRequired<TargetTransformInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
|
|||||||
ModifiedDT = false;
|
ModifiedDT = false;
|
||||||
if (TM)
|
if (TM)
|
||||||
TLI = TM->getSubtargetImpl()->getTargetLowering();
|
TLI = TM->getSubtargetImpl()->getTargetLowering();
|
||||||
TLInfo = &getAnalysis<TargetLibraryInfo>();
|
TLInfo = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
TTI = &getAnalysis<TargetTransformInfo>();
|
TTI = &getAnalysis<TargetTransformInfo>();
|
||||||
DominatorTreeWrapperPass *DTWP =
|
DominatorTreeWrapperPass *DTWP =
|
||||||
getAnalysisIfAvailable<DominatorTreeWrapperPass>();
|
getAnalysisIfAvailable<DominatorTreeWrapperPass>();
|
||||||
|
@ -351,7 +351,8 @@ SelectionDAGISel::SelectionDAGISel(TargetMachine &tm,
|
|||||||
initializeGCModuleInfoPass(*PassRegistry::getPassRegistry());
|
initializeGCModuleInfoPass(*PassRegistry::getPassRegistry());
|
||||||
initializeAliasAnalysisAnalysisGroup(*PassRegistry::getPassRegistry());
|
initializeAliasAnalysisAnalysisGroup(*PassRegistry::getPassRegistry());
|
||||||
initializeBranchProbabilityInfoPass(*PassRegistry::getPassRegistry());
|
initializeBranchProbabilityInfoPass(*PassRegistry::getPassRegistry());
|
||||||
initializeTargetLibraryInfoPass(*PassRegistry::getPassRegistry());
|
initializeTargetLibraryInfoWrapperPassPass(
|
||||||
|
*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionDAGISel::~SelectionDAGISel() {
|
SelectionDAGISel::~SelectionDAGISel() {
|
||||||
@ -365,7 +366,7 @@ void SelectionDAGISel::getAnalysisUsage(AnalysisUsage &AU) const {
|
|||||||
AU.addPreserved<AliasAnalysis>();
|
AU.addPreserved<AliasAnalysis>();
|
||||||
AU.addRequired<GCModuleInfo>();
|
AU.addRequired<GCModuleInfo>();
|
||||||
AU.addPreserved<GCModuleInfo>();
|
AU.addPreserved<GCModuleInfo>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
if (UseMBPI && OptLevel != CodeGenOpt::None)
|
if (UseMBPI && OptLevel != CodeGenOpt::None)
|
||||||
AU.addRequired<BranchProbabilityInfo>();
|
AU.addRequired<BranchProbabilityInfo>();
|
||||||
MachineFunctionPass::getAnalysisUsage(AU);
|
MachineFunctionPass::getAnalysisUsage(AU);
|
||||||
@ -435,7 +436,7 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
|
|||||||
TLI = MF->getSubtarget().getTargetLowering();
|
TLI = MF->getSubtarget().getTargetLowering();
|
||||||
RegInfo = &MF->getRegInfo();
|
RegInfo = &MF->getRegInfo();
|
||||||
AA = &getAnalysis<AliasAnalysis>();
|
AA = &getAnalysis<AliasAnalysis>();
|
||||||
LibInfo = &getAnalysis<TargetLibraryInfo>();
|
LibInfo = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
GFI = Fn.hasGC() ? &getAnalysis<GCModuleInfo>().getFunctionInfo(Fn) : nullptr;
|
GFI = Fn.hasGC() ? &getAnalysis<GCModuleInfo>().getFunctionInfo(Fn) : nullptr;
|
||||||
|
|
||||||
DEBUG(dbgs() << "\n\n\n=== " << Fn.getName() << "\n");
|
DEBUG(dbgs() << "\n\n\n=== " << Fn.getName() << "\n");
|
||||||
|
@ -173,7 +173,8 @@ bool PPCCTRLoops::runOnFunction(Function &F) {
|
|||||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
LibInfo = getAnalysisIfAvailable<TargetLibraryInfo>();
|
auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>();
|
||||||
|
LibInfo = TLIP ? &TLIP->getTLI() : nullptr;
|
||||||
|
|
||||||
bool MadeChange = false;
|
bool MadeChange = false;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ inline LLVMTargetLibraryInfoRef wrap(const TargetLibraryInfo *P) {
|
|||||||
|
|
||||||
void llvm::initializeTarget(PassRegistry &Registry) {
|
void llvm::initializeTarget(PassRegistry &Registry) {
|
||||||
initializeDataLayoutPassPass(Registry);
|
initializeDataLayoutPassPass(Registry);
|
||||||
initializeTargetLibraryInfoPass(Registry);
|
initializeTargetLibraryInfoWrapperPassPass(Registry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVMInitializeTarget(LLVMPassRegistryRef R) {
|
void LLVMInitializeTarget(LLVMPassRegistryRef R) {
|
||||||
@ -54,7 +54,7 @@ void LLVMAddTargetData(LLVMTargetDataRef TD, LLVMPassManagerRef PM) {
|
|||||||
|
|
||||||
void LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef TLI,
|
void LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef TLI,
|
||||||
LLVMPassManagerRef PM) {
|
LLVMPassManagerRef PM) {
|
||||||
unwrap(PM)->add(new TargetLibraryInfo(*unwrap(TLI)));
|
unwrap(PM)->add(new TargetLibraryInfoWrapperPass(*unwrap(TLI)));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD) {
|
char *LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD) {
|
||||||
|
@ -124,7 +124,7 @@ namespace {
|
|||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.setPreservesCFG();
|
AU.setPreservesCFG();
|
||||||
AU.addRequired<AliasAnalysis>();
|
AU.addRequired<AliasAnalysis>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
CallGraphSCCPass::getAnalysisUsage(AU);
|
CallGraphSCCPass::getAnalysisUsage(AU);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ INITIALIZE_PASS_BEGIN(FunctionAttrs, "functionattrs",
|
|||||||
"Deduce function attributes", false, false)
|
"Deduce function attributes", false, false)
|
||||||
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
||||||
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(FunctionAttrs, "functionattrs",
|
INITIALIZE_PASS_END(FunctionAttrs, "functionattrs",
|
||||||
"Deduce function attributes", false, false)
|
"Deduce function attributes", false, false)
|
||||||
|
|
||||||
@ -1702,7 +1702,7 @@ bool FunctionAttrs::annotateLibraryCalls(const CallGraphSCC &SCC) {
|
|||||||
|
|
||||||
bool FunctionAttrs::runOnSCC(CallGraphSCC &SCC) {
|
bool FunctionAttrs::runOnSCC(CallGraphSCC &SCC) {
|
||||||
AA = &getAnalysis<AliasAnalysis>();
|
AA = &getAnalysis<AliasAnalysis>();
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
|
||||||
bool Changed = annotateLibraryCalls(SCC);
|
bool Changed = annotateLibraryCalls(SCC);
|
||||||
Changed |= AddReadAttrs(SCC);
|
Changed |= AddReadAttrs(SCC);
|
||||||
|
@ -68,7 +68,7 @@ STATISTIC(NumCXXDtorsRemoved, "Number of global C++ destructors removed");
|
|||||||
namespace {
|
namespace {
|
||||||
struct GlobalOpt : public ModulePass {
|
struct GlobalOpt : public ModulePass {
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
GlobalOpt() : ModulePass(ID) {
|
GlobalOpt() : ModulePass(ID) {
|
||||||
@ -95,7 +95,7 @@ namespace {
|
|||||||
char GlobalOpt::ID = 0;
|
char GlobalOpt::ID = 0;
|
||||||
INITIALIZE_PASS_BEGIN(GlobalOpt, "globalopt",
|
INITIALIZE_PASS_BEGIN(GlobalOpt, "globalopt",
|
||||||
"Global Variable Optimizer", false, false)
|
"Global Variable Optimizer", false, false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(GlobalOpt, "globalopt",
|
INITIALIZE_PASS_END(GlobalOpt, "globalopt",
|
||||||
"Global Variable Optimizer", false, false)
|
"Global Variable Optimizer", false, false)
|
||||||
|
|
||||||
@ -3042,7 +3042,7 @@ bool GlobalOpt::runOnModule(Module &M) {
|
|||||||
|
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
|
||||||
bool LocalChange = true;
|
bool LocalChange = true;
|
||||||
while (LocalChange) {
|
while (LocalChange) {
|
||||||
|
@ -446,7 +446,8 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC) {
|
|||||||
AssumptionCacheTracker *ACT = &getAnalysis<AssumptionCacheTracker>();
|
AssumptionCacheTracker *ACT = &getAnalysis<AssumptionCacheTracker>();
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
const TargetLibraryInfo *TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
|
auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>();
|
||||||
|
const TargetLibraryInfo *TLI = TLIP ? &TLIP->getTLI() : nullptr;
|
||||||
AliasAnalysis *AA = &getAnalysis<AliasAnalysis>();
|
AliasAnalysis *AA = &getAnalysis<AliasAnalysis>();
|
||||||
|
|
||||||
SmallPtrSet<Function*, 8> SCCFunctions;
|
SmallPtrSet<Function*, 8> SCCFunctions;
|
||||||
|
@ -143,7 +143,8 @@ void PassManagerBuilder::populateFunctionPassManager(FunctionPassManager &FPM) {
|
|||||||
addExtensionsToPM(EP_EarlyAsPossible, FPM);
|
addExtensionsToPM(EP_EarlyAsPossible, FPM);
|
||||||
|
|
||||||
// Add LibraryInfo if we have some.
|
// Add LibraryInfo if we have some.
|
||||||
if (LibraryInfo) FPM.add(new TargetLibraryInfo(*LibraryInfo));
|
if (LibraryInfo)
|
||||||
|
FPM.add(new TargetLibraryInfoWrapperPass(*LibraryInfo));
|
||||||
|
|
||||||
if (OptLevel == 0) return;
|
if (OptLevel == 0) return;
|
||||||
|
|
||||||
@ -182,7 +183,8 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add LibraryInfo if we have some.
|
// Add LibraryInfo if we have some.
|
||||||
if (LibraryInfo) MPM.add(new TargetLibraryInfo(*LibraryInfo));
|
if (LibraryInfo)
|
||||||
|
MPM.add(new TargetLibraryInfoWrapperPass(*LibraryInfo));
|
||||||
|
|
||||||
addInitialAliasAnalysisPasses(MPM);
|
addInitialAliasAnalysisPasses(MPM);
|
||||||
|
|
||||||
@ -485,7 +487,7 @@ void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (LibraryInfo)
|
if (LibraryInfo)
|
||||||
PM.add(new TargetLibraryInfo(*LibraryInfo));
|
PM.add(new TargetLibraryInfoWrapperPass(*LibraryInfo));
|
||||||
|
|
||||||
if (VerifyInput)
|
if (VerifyInput)
|
||||||
PM.add(createVerifierPass());
|
PM.add(createVerifierPass());
|
||||||
|
@ -85,7 +85,7 @@ char InstCombiner::ID = 0;
|
|||||||
INITIALIZE_PASS_BEGIN(InstCombiner, "instcombine",
|
INITIALIZE_PASS_BEGIN(InstCombiner, "instcombine",
|
||||||
"Combine redundant instructions", false, false)
|
"Combine redundant instructions", false, false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
||||||
INITIALIZE_PASS_END(InstCombiner, "instcombine",
|
INITIALIZE_PASS_END(InstCombiner, "instcombine",
|
||||||
"Combine redundant instructions", false, false)
|
"Combine redundant instructions", false, false)
|
||||||
@ -93,7 +93,7 @@ INITIALIZE_PASS_END(InstCombiner, "instcombine",
|
|||||||
void InstCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
|
void InstCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.setPreservesCFG();
|
AU.setPreservesCFG();
|
||||||
AU.addRequired<AssumptionCacheTracker>();
|
AU.addRequired<AssumptionCacheTracker>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
AU.addRequired<DominatorTreeWrapperPass>();
|
AU.addRequired<DominatorTreeWrapperPass>();
|
||||||
AU.addPreserved<DominatorTreeWrapperPass>();
|
AU.addPreserved<DominatorTreeWrapperPass>();
|
||||||
}
|
}
|
||||||
@ -2974,7 +2974,7 @@ bool InstCombiner::runOnFunction(Function &F) {
|
|||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
|
||||||
// Minimizing size?
|
// Minimizing size?
|
||||||
MinimizeSize = F.getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
MinimizeSize = F.getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
||||||
|
@ -50,7 +50,7 @@ namespace {
|
|||||||
|
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addRequired<DataLayoutPass>();
|
AU.addRequired<DataLayoutPass>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -166,7 +166,7 @@ bool BoundsChecking::instrument(Value *Ptr, Value *InstVal) {
|
|||||||
|
|
||||||
bool BoundsChecking::runOnFunction(Function &F) {
|
bool BoundsChecking::runOnFunction(Function &F) {
|
||||||
DL = &getAnalysis<DataLayoutPass>().getDataLayout();
|
DL = &getAnalysis<DataLayoutPass>().getDataLayout();
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
|
||||||
TrapBB = nullptr;
|
TrapBB = nullptr;
|
||||||
BuilderTy TheBuilder(F.getContext(), TargetFolder(DL));
|
BuilderTy TheBuilder(F.getContext(), TargetFolder(DL));
|
||||||
|
@ -45,7 +45,7 @@ namespace {
|
|||||||
|
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.setPreservesCFG();
|
AU.setPreservesCFG();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ namespace {
|
|||||||
char ConstantPropagation::ID = 0;
|
char ConstantPropagation::ID = 0;
|
||||||
INITIALIZE_PASS_BEGIN(ConstantPropagation, "constprop",
|
INITIALIZE_PASS_BEGIN(ConstantPropagation, "constprop",
|
||||||
"Simple constant propagation", false, false)
|
"Simple constant propagation", false, false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(ConstantPropagation, "constprop",
|
INITIALIZE_PASS_END(ConstantPropagation, "constprop",
|
||||||
"Simple constant propagation", false, false)
|
"Simple constant propagation", false, false)
|
||||||
|
|
||||||
@ -70,7 +70,8 @@ bool ConstantPropagation::runOnFunction(Function &F) {
|
|||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
TargetLibraryInfo *TLI =
|
||||||
|
&getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
|
||||||
while (!WorkList.empty()) {
|
while (!WorkList.empty()) {
|
||||||
Instruction *I = *WorkList.begin();
|
Instruction *I = *WorkList.begin();
|
||||||
|
@ -42,7 +42,8 @@ namespace {
|
|||||||
bool runOnBasicBlock(BasicBlock &BB) override {
|
bool runOnBasicBlock(BasicBlock &BB) override {
|
||||||
if (skipOptnoneFunction(BB))
|
if (skipOptnoneFunction(BB))
|
||||||
return false;
|
return false;
|
||||||
TargetLibraryInfo *TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
|
auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>();
|
||||||
|
TargetLibraryInfo *TLI = TLIP ? &TLIP->getTLI() : nullptr;
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) {
|
for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) {
|
||||||
Instruction *Inst = DI++;
|
Instruction *Inst = DI++;
|
||||||
@ -95,7 +96,8 @@ bool DCE::runOnFunction(Function &F) {
|
|||||||
if (skipOptnoneFunction(F))
|
if (skipOptnoneFunction(F))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TargetLibraryInfo *TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
|
auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>();
|
||||||
|
TargetLibraryInfo *TLI = TLIP ? &TLIP->getTLI() : nullptr;
|
||||||
|
|
||||||
// Start out with all of the instructions in the worklist...
|
// Start out with all of the instructions in the worklist...
|
||||||
std::vector<Instruction*> WorkList;
|
std::vector<Instruction*> WorkList;
|
||||||
|
@ -385,7 +385,7 @@ private:
|
|||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addRequired<AssumptionCacheTracker>();
|
AU.addRequired<AssumptionCacheTracker>();
|
||||||
AU.addRequired<DominatorTreeWrapperPass>();
|
AU.addRequired<DominatorTreeWrapperPass>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
AU.setPreservesCFG();
|
AU.setPreservesCFG();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -401,7 +401,7 @@ FunctionPass *llvm::createEarlyCSEPass() {
|
|||||||
INITIALIZE_PASS_BEGIN(EarlyCSE, "early-cse", "Early CSE", false, false)
|
INITIALIZE_PASS_BEGIN(EarlyCSE, "early-cse", "Early CSE", false, false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(EarlyCSE, "early-cse", "Early CSE", false, false)
|
INITIALIZE_PASS_END(EarlyCSE, "early-cse", "Early CSE", false, false)
|
||||||
|
|
||||||
bool EarlyCSE::processNode(DomTreeNode *Node) {
|
bool EarlyCSE::processNode(DomTreeNode *Node) {
|
||||||
@ -580,7 +580,7 @@ bool EarlyCSE::runOnFunction(Function &F) {
|
|||||||
|
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||||
AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
|
AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ namespace {
|
|||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addRequired<AssumptionCacheTracker>();
|
AU.addRequired<AssumptionCacheTracker>();
|
||||||
AU.addRequired<DominatorTreeWrapperPass>();
|
AU.addRequired<DominatorTreeWrapperPass>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
if (!NoLoads)
|
if (!NoLoads)
|
||||||
AU.addRequired<MemoryDependenceAnalysis>();
|
AU.addRequired<MemoryDependenceAnalysis>();
|
||||||
AU.addRequired<AliasAnalysis>();
|
AU.addRequired<AliasAnalysis>();
|
||||||
@ -736,7 +736,7 @@ INITIALIZE_PASS_BEGIN(GVN, "gvn", "Global Value Numbering", false, false)
|
|||||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||||
INITIALIZE_PASS_DEPENDENCY(MemoryDependenceAnalysis)
|
INITIALIZE_PASS_DEPENDENCY(MemoryDependenceAnalysis)
|
||||||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
||||||
INITIALIZE_PASS_END(GVN, "gvn", "Global Value Numbering", false, false)
|
INITIALIZE_PASS_END(GVN, "gvn", "Global Value Numbering", false, false)
|
||||||
|
|
||||||
@ -2350,7 +2350,7 @@ bool GVN::runOnFunction(Function& F) {
|
|||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
|
AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
VN.setAliasAnalysis(&getAnalysis<AliasAnalysis>());
|
VN.setAliasAnalysis(&getAnalysis<AliasAnalysis>());
|
||||||
VN.setMemDep(MD);
|
VN.setMemDep(MD);
|
||||||
VN.setDomTree(DT);
|
VN.setDomTree(DT);
|
||||||
|
@ -1934,7 +1934,8 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
|||||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
|
auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>();
|
||||||
|
TLI = TLIP ? &TLIP->getTLI() : nullptr;
|
||||||
TTI = getAnalysisIfAvailable<TargetTransformInfo>();
|
TTI = getAnalysisIfAvailable<TargetTransformInfo>();
|
||||||
|
|
||||||
DeadInsts.clear();
|
DeadInsts.clear();
|
||||||
|
@ -115,7 +115,7 @@ namespace {
|
|||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addRequired<LazyValueInfo>();
|
AU.addRequired<LazyValueInfo>();
|
||||||
AU.addPreserved<LazyValueInfo>();
|
AU.addPreserved<LazyValueInfo>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindLoopHeaders(Function &F);
|
void FindLoopHeaders(Function &F);
|
||||||
@ -145,7 +145,7 @@ char JumpThreading::ID = 0;
|
|||||||
INITIALIZE_PASS_BEGIN(JumpThreading, "jump-threading",
|
INITIALIZE_PASS_BEGIN(JumpThreading, "jump-threading",
|
||||||
"Jump Threading", false, false)
|
"Jump Threading", false, false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LazyValueInfo)
|
INITIALIZE_PASS_DEPENDENCY(LazyValueInfo)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(JumpThreading, "jump-threading",
|
INITIALIZE_PASS_END(JumpThreading, "jump-threading",
|
||||||
"Jump Threading", false, false)
|
"Jump Threading", false, false)
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ bool JumpThreading::runOnFunction(Function &F) {
|
|||||||
DEBUG(dbgs() << "Jump threading on function '" << F.getName() << "'\n");
|
DEBUG(dbgs() << "Jump threading on function '" << F.getName() << "'\n");
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
LVI = &getAnalysis<LazyValueInfo>();
|
LVI = &getAnalysis<LazyValueInfo>();
|
||||||
|
|
||||||
// Remove unreachable blocks from function as they may result in infinite
|
// Remove unreachable blocks from function as they may result in infinite
|
||||||
|
@ -94,7 +94,7 @@ namespace {
|
|||||||
AU.addRequired<AliasAnalysis>();
|
AU.addRequired<AliasAnalysis>();
|
||||||
AU.addPreserved<AliasAnalysis>();
|
AU.addPreserved<AliasAnalysis>();
|
||||||
AU.addPreserved<ScalarEvolution>();
|
AU.addPreserved<ScalarEvolution>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
|
|
||||||
using llvm::Pass::doFinalization;
|
using llvm::Pass::doFinalization;
|
||||||
@ -214,7 +214,7 @@ INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
|||||||
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
||||||
INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
|
INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
||||||
INITIALIZE_PASS_END(LICM, "licm", "Loop Invariant Code Motion", false, false)
|
INITIALIZE_PASS_END(LICM, "licm", "Loop Invariant Code Motion", false, false)
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ bool LICM::runOnLoop(Loop *L, LPPassManager &LPM) {
|
|||||||
|
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
|
||||||
assert(L->isLCSSAForm(*DT) && "Loop is not in LCSSA form.");
|
assert(L->isLCSSAForm(*DT) && "Loop is not in LCSSA form.");
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ namespace {
|
|||||||
AU.addPreserved<ScalarEvolution>();
|
AU.addPreserved<ScalarEvolution>();
|
||||||
AU.addPreserved<DominatorTreeWrapperPass>();
|
AU.addPreserved<DominatorTreeWrapperPass>();
|
||||||
AU.addRequired<DominatorTreeWrapperPass>();
|
AU.addRequired<DominatorTreeWrapperPass>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
AU.addRequired<TargetTransformInfo>();
|
AU.addRequired<TargetTransformInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,10 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TargetLibraryInfo *getTargetLibraryInfo() {
|
TargetLibraryInfo *getTargetLibraryInfo() {
|
||||||
return TLI ? TLI : (TLI = &getAnalysis<TargetLibraryInfo>());
|
if (!TLI)
|
||||||
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
|
||||||
|
return TLI;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TargetTransformInfo *getTargetTransformInfo() {
|
const TargetTransformInfo *getTargetTransformInfo() {
|
||||||
@ -220,7 +223,7 @@ INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
|||||||
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
||||||
INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
|
INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
||||||
INITIALIZE_AG_DEPENDENCY(TargetTransformInfo)
|
INITIALIZE_AG_DEPENDENCY(TargetTransformInfo)
|
||||||
INITIALIZE_PASS_END(LoopIdiomRecognize, "loop-idiom", "Recognize loop idioms",
|
INITIALIZE_PASS_END(LoopIdiomRecognize, "loop-idiom", "Recognize loop idioms",
|
||||||
@ -667,7 +670,7 @@ bool LoopIdiomRecognize::runOnCountableLoop() {
|
|||||||
(void)getDominatorTree();
|
(void)getDominatorTree();
|
||||||
|
|
||||||
LoopInfo &LI = getAnalysis<LoopInfo>();
|
LoopInfo &LI = getAnalysis<LoopInfo>();
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
|
||||||
// set TLI
|
// set TLI
|
||||||
(void)getTargetLibraryInfo();
|
(void)getTargetLibraryInfo();
|
||||||
|
@ -48,7 +48,7 @@ namespace {
|
|||||||
AU.addPreservedID(LoopSimplifyID);
|
AU.addPreservedID(LoopSimplifyID);
|
||||||
AU.addPreservedID(LCSSAID);
|
AU.addPreservedID(LCSSAID);
|
||||||
AU.addPreserved("scalar-evolution");
|
AU.addPreserved("scalar-evolution");
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ char LoopInstSimplify::ID = 0;
|
|||||||
INITIALIZE_PASS_BEGIN(LoopInstSimplify, "loop-instsimplify",
|
INITIALIZE_PASS_BEGIN(LoopInstSimplify, "loop-instsimplify",
|
||||||
"Simplify instructions in loops", false, false)
|
"Simplify instructions in loops", false, false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
||||||
@ -78,7 +78,8 @@ bool LoopInstSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
|||||||
LoopInfo *LI = &getAnalysis<LoopInfo>();
|
LoopInfo *LI = &getAnalysis<LoopInfo>();
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
const TargetLibraryInfo *TLI =
|
||||||
|
&getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
auto &AC = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(
|
auto &AC = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(
|
||||||
*L->getHeader()->getParent());
|
*L->getHeader()->getParent());
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ namespace {
|
|||||||
AU.addRequired<DominatorTreeWrapperPass>();
|
AU.addRequired<DominatorTreeWrapperPass>();
|
||||||
AU.addPreserved<DominatorTreeWrapperPass>();
|
AU.addPreserved<DominatorTreeWrapperPass>();
|
||||||
AU.addRequired<ScalarEvolution>();
|
AU.addRequired<ScalarEvolution>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -342,7 +342,7 @@ INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
|||||||
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
||||||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
||||||
INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
|
INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(LoopReroll, "loop-reroll", "Reroll loops", false, false)
|
INITIALIZE_PASS_END(LoopReroll, "loop-reroll", "Reroll loops", false, false)
|
||||||
|
|
||||||
Pass *llvm::createLoopRerollPass() {
|
Pass *llvm::createLoopRerollPass() {
|
||||||
@ -1131,7 +1131,7 @@ bool LoopReroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
|||||||
AA = &getAnalysis<AliasAnalysis>();
|
AA = &getAnalysis<AliasAnalysis>();
|
||||||
LI = &getAnalysis<LoopInfo>();
|
LI = &getAnalysis<LoopInfo>();
|
||||||
SE = &getAnalysis<ScalarEvolution>();
|
SE = &getAnalysis<ScalarEvolution>();
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||||
|
@ -334,7 +334,7 @@ namespace {
|
|||||||
AU.addRequired<DominatorTreeWrapperPass>();
|
AU.addRequired<DominatorTreeWrapperPass>();
|
||||||
AU.addRequired<MemoryDependenceAnalysis>();
|
AU.addRequired<MemoryDependenceAnalysis>();
|
||||||
AU.addRequired<AliasAnalysis>();
|
AU.addRequired<AliasAnalysis>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
AU.addPreserved<AliasAnalysis>();
|
AU.addPreserved<AliasAnalysis>();
|
||||||
AU.addPreserved<MemoryDependenceAnalysis>();
|
AU.addPreserved<MemoryDependenceAnalysis>();
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ INITIALIZE_PASS_BEGIN(MemCpyOpt, "memcpyopt", "MemCpy Optimization",
|
|||||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
||||||
INITIALIZE_PASS_DEPENDENCY(MemoryDependenceAnalysis)
|
INITIALIZE_PASS_DEPENDENCY(MemoryDependenceAnalysis)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
||||||
INITIALIZE_PASS_END(MemCpyOpt, "memcpyopt", "MemCpy Optimization",
|
INITIALIZE_PASS_END(MemCpyOpt, "memcpyopt", "MemCpy Optimization",
|
||||||
false, false)
|
false, false)
|
||||||
@ -1069,7 +1069,7 @@ bool MemCpyOpt::runOnFunction(Function &F) {
|
|||||||
MD = &getAnalysis<MemoryDependenceAnalysis>();
|
MD = &getAnalysis<MemoryDependenceAnalysis>();
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
|
||||||
// If we don't have at least memset and memcpy, there is little point of doing
|
// If we don't have at least memset and memcpy, there is little point of doing
|
||||||
// anything here. These are required by a freestanding implementation, so if
|
// anything here. These are required by a freestanding implementation, so if
|
||||||
|
@ -115,7 +115,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
// This transformation requires dominator postdominator info
|
// This transformation requires dominator postdominator info
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
AU.addRequired<MemoryDependenceAnalysis>();
|
AU.addRequired<MemoryDependenceAnalysis>();
|
||||||
AU.addRequired<AliasAnalysis>();
|
AU.addRequired<AliasAnalysis>();
|
||||||
AU.addPreserved<AliasAnalysis>();
|
AU.addPreserved<AliasAnalysis>();
|
||||||
@ -168,7 +168,7 @@ FunctionPass *llvm::createMergedLoadStoreMotionPass() {
|
|||||||
INITIALIZE_PASS_BEGIN(MergedLoadStoreMotion, "mldst-motion",
|
INITIALIZE_PASS_BEGIN(MergedLoadStoreMotion, "mldst-motion",
|
||||||
"MergedLoadStoreMotion", false, false)
|
"MergedLoadStoreMotion", false, false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(MemoryDependenceAnalysis)
|
INITIALIZE_PASS_DEPENDENCY(MemoryDependenceAnalysis)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
||||||
INITIALIZE_PASS_END(MergedLoadStoreMotion, "mldst-motion",
|
INITIALIZE_PASS_END(MergedLoadStoreMotion, "mldst-motion",
|
||||||
"MergedLoadStoreMotion", false, false)
|
"MergedLoadStoreMotion", false, false)
|
||||||
|
@ -52,7 +52,7 @@ INITIALIZE_PASS(PartiallyInlineLibCalls, "partially-inline-libcalls",
|
|||||||
"Partially inline calls to library functions", false, false)
|
"Partially inline calls to library functions", false, false)
|
||||||
|
|
||||||
void PartiallyInlineLibCalls::getAnalysisUsage(AnalysisUsage &AU) const {
|
void PartiallyInlineLibCalls::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
AU.addRequired<TargetTransformInfo>();
|
AU.addRequired<TargetTransformInfo>();
|
||||||
FunctionPass::getAnalysisUsage(AU);
|
FunctionPass::getAnalysisUsage(AU);
|
||||||
}
|
}
|
||||||
@ -60,7 +60,8 @@ void PartiallyInlineLibCalls::getAnalysisUsage(AnalysisUsage &AU) const {
|
|||||||
bool PartiallyInlineLibCalls::runOnFunction(Function &F) {
|
bool PartiallyInlineLibCalls::runOnFunction(Function &F) {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
Function::iterator CurrBB;
|
Function::iterator CurrBB;
|
||||||
TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
TargetLibraryInfo *TLI =
|
||||||
|
&getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
const TargetTransformInfo *TTI = &getAnalysis<TargetTransformInfo>();
|
const TargetTransformInfo *TTI = &getAnalysis<TargetTransformInfo>();
|
||||||
for (Function::iterator BB = F.begin(), BE = F.end(); BB != BE;) {
|
for (Function::iterator BB = F.begin(), BE = F.end(); BB != BE;) {
|
||||||
CurrBB = BB++;
|
CurrBB = BB++;
|
||||||
|
@ -1504,7 +1504,7 @@ namespace {
|
|||||||
///
|
///
|
||||||
struct SCCP : public FunctionPass {
|
struct SCCP : public FunctionPass {
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
SCCP() : FunctionPass(ID) {
|
SCCP() : FunctionPass(ID) {
|
||||||
@ -1563,7 +1563,8 @@ bool SCCP::runOnFunction(Function &F) {
|
|||||||
DEBUG(dbgs() << "SCCP on function '" << F.getName() << "'\n");
|
DEBUG(dbgs() << "SCCP on function '" << F.getName() << "'\n");
|
||||||
const DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
const DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
const TargetLibraryInfo *TLI =
|
||||||
|
&getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
SCCPSolver Solver(DL, TLI);
|
SCCPSolver Solver(DL, TLI);
|
||||||
|
|
||||||
// Mark the first block of the function as being executable.
|
// Mark the first block of the function as being executable.
|
||||||
@ -1637,7 +1638,7 @@ namespace {
|
|||||||
///
|
///
|
||||||
struct IPSCCP : public ModulePass {
|
struct IPSCCP : public ModulePass {
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
static char ID;
|
static char ID;
|
||||||
IPSCCP() : ModulePass(ID) {
|
IPSCCP() : ModulePass(ID) {
|
||||||
@ -1651,7 +1652,7 @@ char IPSCCP::ID = 0;
|
|||||||
INITIALIZE_PASS_BEGIN(IPSCCP, "ipsccp",
|
INITIALIZE_PASS_BEGIN(IPSCCP, "ipsccp",
|
||||||
"Interprocedural Sparse Conditional Constant Propagation",
|
"Interprocedural Sparse Conditional Constant Propagation",
|
||||||
false, false)
|
false, false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(IPSCCP, "ipsccp",
|
INITIALIZE_PASS_END(IPSCCP, "ipsccp",
|
||||||
"Interprocedural Sparse Conditional Constant Propagation",
|
"Interprocedural Sparse Conditional Constant Propagation",
|
||||||
false, false)
|
false, false)
|
||||||
@ -1692,7 +1693,8 @@ static bool AddressIsTaken(const GlobalValue *GV) {
|
|||||||
bool IPSCCP::runOnModule(Module &M) {
|
bool IPSCCP::runOnModule(Module &M) {
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
const TargetLibraryInfo *TLI =
|
||||||
|
&getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
SCCPSolver Solver(DL, TLI);
|
SCCPSolver Solver(DL, TLI);
|
||||||
|
|
||||||
// AddressTakenFunctions - This set keeps track of the address-taken functions
|
// AddressTakenFunctions - This set keeps track of the address-taken functions
|
||||||
|
@ -43,7 +43,7 @@ namespace {
|
|||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.setPreservesCFG();
|
AU.setPreservesCFG();
|
||||||
AU.addRequired<AssumptionCacheTracker>();
|
AU.addRequired<AssumptionCacheTracker>();
|
||||||
AU.addRequired<TargetLibraryInfo>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// runOnFunction - Remove instructions that simplify.
|
/// runOnFunction - Remove instructions that simplify.
|
||||||
@ -53,7 +53,8 @@ namespace {
|
|||||||
const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : nullptr;
|
const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : nullptr;
|
||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
const TargetLibraryInfo *TLI =
|
||||||
|
&getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
AssumptionCache *AC =
|
AssumptionCache *AC =
|
||||||
&getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
|
&getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
|
||||||
SmallPtrSet<const Instruction*, 8> S1, S2, *ToSimplify = &S1, *Next = &S2;
|
SmallPtrSet<const Instruction*, 8> S1, S2, *ToSimplify = &S1, *Next = &S2;
|
||||||
@ -106,7 +107,7 @@ char InstSimplifier::ID = 0;
|
|||||||
INITIALIZE_PASS_BEGIN(InstSimplifier, "instsimplify",
|
INITIALIZE_PASS_BEGIN(InstSimplifier, "instsimplify",
|
||||||
"Remove redundant instructions", false, false)
|
"Remove redundant instructions", false, false)
|
||||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(InstSimplifier, "instsimplify",
|
INITIALIZE_PASS_END(InstSimplifier, "instsimplify",
|
||||||
"Remove redundant instructions", false, false)
|
"Remove redundant instructions", false, false)
|
||||||
char &llvm::InstructionSimplifierID = InstSimplifier::ID;
|
char &llvm::InstructionSimplifierID = InstSimplifier::ID;
|
||||||
|
@ -1281,7 +1281,8 @@ struct LoopVectorize : public FunctionPass {
|
|||||||
TTI = &getAnalysis<TargetTransformInfo>();
|
TTI = &getAnalysis<TargetTransformInfo>();
|
||||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||||
BFI = &getAnalysis<BlockFrequencyInfo>();
|
BFI = &getAnalysis<BlockFrequencyInfo>();
|
||||||
TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
|
auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>();
|
||||||
|
TLI = TLIP ? &TLIP->getTLI() : nullptr;
|
||||||
AA = &getAnalysis<AliasAnalysis>();
|
AA = &getAnalysis<AliasAnalysis>();
|
||||||
AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
|
AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
|
||||||
|
|
||||||
|
@ -2890,7 +2890,8 @@ struct SLPVectorizer : public FunctionPass {
|
|||||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||||
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
DL = DLP ? &DLP->getDataLayout() : nullptr;
|
||||||
TTI = &getAnalysis<TargetTransformInfo>();
|
TTI = &getAnalysis<TargetTransformInfo>();
|
||||||
TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
|
auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>();
|
||||||
|
TLI = TLIP ? &TLIP->getTLI() : nullptr;
|
||||||
AA = &getAnalysis<AliasAnalysis>();
|
AA = &getAnalysis<AliasAnalysis>();
|
||||||
LI = &getAnalysis<LoopInfo>();
|
LI = &getAnalysis<LoopInfo>();
|
||||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||||
|
@ -296,10 +296,12 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
|||||||
PassManager PM;
|
PassManager PM;
|
||||||
|
|
||||||
// Add an appropriate TargetLibraryInfo pass for the module's triple.
|
// Add an appropriate TargetLibraryInfo pass for the module's triple.
|
||||||
TargetLibraryInfo *TLI = new TargetLibraryInfo(TheTriple);
|
TargetLibraryInfo TLI(Triple(M->getTargetTriple()));
|
||||||
|
|
||||||
|
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
|
||||||
if (DisableSimplifyLibCalls)
|
if (DisableSimplifyLibCalls)
|
||||||
TLI->disableAllFunctions();
|
TLI.disableAllFunctions();
|
||||||
PM.add(TLI);
|
PM.add(new TargetLibraryInfoWrapperPass(TLI));
|
||||||
|
|
||||||
// Add the target data from the target machine, if it exists, or the module.
|
// Add the target data from the target machine, if it exists, or the module.
|
||||||
if (const DataLayout *DL = Target->getSubtargetImpl()->getDataLayout())
|
if (const DataLayout *DL = Target->getSubtargetImpl()->getDataLayout())
|
||||||
|
@ -401,12 +401,12 @@ int main(int argc, char **argv) {
|
|||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
|
|
||||||
// Add an appropriate TargetLibraryInfo pass for the module's triple.
|
// Add an appropriate TargetLibraryInfo pass for the module's triple.
|
||||||
TargetLibraryInfo *TLI = new TargetLibraryInfo(Triple(M->getTargetTriple()));
|
TargetLibraryInfo TLI(Triple(M->getTargetTriple()));
|
||||||
|
|
||||||
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
|
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
|
||||||
if (DisableSimplifyLibCalls)
|
if (DisableSimplifyLibCalls)
|
||||||
TLI->disableAllFunctions();
|
TLI.disableAllFunctions();
|
||||||
Passes.add(TLI);
|
Passes.add(new TargetLibraryInfoWrapperPass(TLI));
|
||||||
|
|
||||||
// Add an appropriate DataLayout instance for this module.
|
// Add an appropriate DataLayout instance for this module.
|
||||||
const DataLayout *DL = M->getDataLayout();
|
const DataLayout *DL = M->getDataLayout();
|
||||||
|
Loading…
Reference in New Issue
Block a user