From 2ce38b3f038482e9d21661d1b328a42664301f03 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Wed, 2 Dec 2020 19:53:17 +0300 Subject: [PATCH] [NFC] Reduce include files dependency. 1. Removed #include "...AliasAnalysis.h" in other headers and modules. 2. Cleaned up includes in AliasAnalysis.h. Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D92489 --- llvm/include/llvm/Analysis/AliasAnalysis.h | 10 ++------ llvm/include/llvm/Analysis/AliasSetTracker.h | 21 +++++++++-------- .../llvm/Analysis/BasicAliasAnalysis.h | 2 -- .../llvm/Analysis/ObjCARCAnalysisUtils.h | 23 ++++--------------- llvm/include/llvm/CodeGen/MachinePipeliner.h | 15 +++--------- llvm/include/llvm/Transforms/IPO/Attributor.h | 7 +++--- .../llvm/Transforms/Scalar/JumpThreading.h | 14 ++++++----- .../llvm/Transforms/Scalar/LoopPassManager.h | 2 +- .../llvm/Transforms/Scalar/MemCpyOptimizer.h | 12 ++++++---- llvm/lib/Analysis/AliasAnalysis.cpp | 7 ++++++ llvm/lib/Analysis/IVDescriptors.cpp | 1 - llvm/lib/Analysis/LoopAnalysisManager.cpp | 1 + llvm/lib/Analysis/ObjCARCAnalysisUtils.cpp | 20 ++++++++++++++++ llvm/lib/CodeGen/LiveRangeEdit.cpp | 1 - llvm/lib/CodeGen/MachineFunctionPass.cpp | 1 - llvm/lib/CodeGen/MachinePipeliner.cpp | 10 ++++++++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 1 + llvm/lib/LTO/LTOBackend.cpp | 1 - llvm/lib/Target/ARM/ARMParallelDSP.cpp | 1 + llvm/lib/Transforms/IPO/Attributor.cpp | 4 ++++ .../Transforms/IPO/AttributorAttributes.cpp | 1 + .../lib/Transforms/IPO/WholeProgramDevirt.cpp | 1 + .../Instrumentation/PGOMemOPSizeOpt.cpp | 1 + .../Transforms/ObjCARC/DependencyAnalysis.cpp | 1 + llvm/lib/Transforms/ObjCARC/ObjCARC.h | 2 -- .../Transforms/ObjCARC/ObjCARCContract.cpp | 5 ++-- llvm/lib/Transforms/Scalar/LoopRotation.cpp | 1 + .../Transforms/Scalar/LoopStrengthReduce.cpp | 1 + .../Transforms/Utils/InjectTLIMappings.cpp | 1 + llvm/tools/opt/NewPMDriver.cpp | 1 - .../Analysis/AliasSetTrackerTest.cpp | 1 + .../Analysis/BasicAliasAnalysisTest.cpp | 2 ++ llvm/unittests/Analysis/DDGTest.cpp | 1 + llvm/unittests/Analysis/GlobalsModRefTest.cpp | 1 + llvm/unittests/Analysis/MemorySSATest.cpp | 2 ++ .../Transforms/Utils/CodeMoverUtilsTest.cpp | 1 + .../Transforms/Vectorize/VPlanSlpTest.cpp | 1 + polly/include/polly/ScopBuilder.h | 6 ++--- polly/include/polly/ScopDetection.h | 9 ++++---- polly/include/polly/ScopInfo.h | 8 +++---- 40 files changed, 115 insertions(+), 86 deletions(-) diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h index 736917cf327a..7a4338905129 100644 --- a/llvm/include/llvm/Analysis/AliasAnalysis.h +++ b/llvm/include/llvm/Analysis/AliasAnalysis.h @@ -42,8 +42,6 @@ #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/MemoryLocation.h" -#include "llvm/Analysis/TargetLibraryInfo.h" -#include "llvm/IR/Function.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/PassManager.h" @@ -59,6 +57,7 @@ class AnalysisUsage; class BasicAAResult; class BasicBlock; class DominatorTree; +class Function; class Value; /// The possible results of an alias query. @@ -1172,12 +1171,7 @@ public: ResultGetters.push_back(&getModuleAAResultImpl); } - Result run(Function &F, FunctionAnalysisManager &AM) { - Result R(AM.getResult(F)); - for (auto &Getter : ResultGetters) - (*Getter)(F, AM, R); - return R; - } + Result run(Function &F, FunctionAnalysisManager &AM); private: friend AnalysisInfoMixin; diff --git a/llvm/include/llvm/Analysis/AliasSetTracker.h b/llvm/include/llvm/Analysis/AliasSetTracker.h index 1db657528d19..b27fd5aa92a7 100644 --- a/llvm/include/llvm/Analysis/AliasSetTracker.h +++ b/llvm/include/llvm/Analysis/AliasSetTracker.h @@ -20,7 +20,7 @@ #include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/ilist.h" #include "llvm/ADT/ilist_node.h" -#include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/MemoryLocation.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/PassManager.h" @@ -34,6 +34,7 @@ namespace llvm { +class AAResults; class AliasSetTracker; class BasicBlock; class LoadInst; @@ -46,6 +47,8 @@ class StoreInst; class VAArgInst; class Value; +enum AliasResult : uint8_t; + class AliasSet : public ilist_node { friend class AliasSetTracker; @@ -294,7 +297,7 @@ private: void addPointer(AliasSetTracker &AST, PointerRec &Entry, LocationSize Size, const AAMDNodes &AAInfo, bool KnownMustAlias = false, bool SkipSizeUpdate = false); - void addUnknownInst(Instruction *I, AliasAnalysis &AA); + void addUnknownInst(Instruction *I, AAResults &AA); void removeUnknownInst(AliasSetTracker &AST, Instruction *I) { bool WasEmpty = UnknownInsts.empty(); @@ -312,8 +315,8 @@ public: /// If the specified pointer "may" (or must) alias one of the members in the /// set return the appropriate AliasResult. Otherwise return NoAlias. AliasResult aliasesPointer(const Value *Ptr, LocationSize Size, - const AAMDNodes &AAInfo, AliasAnalysis &AA) const; - bool aliasesUnknownInst(const Instruction *Inst, AliasAnalysis &AA) const; + const AAMDNodes &AAInfo, AAResults &AA) const; + bool aliasesUnknownInst(const Instruction *Inst, AAResults &AA) const; }; inline raw_ostream& operator<<(raw_ostream &OS, const AliasSet &AS) { @@ -339,7 +342,7 @@ class AliasSetTracker { /// handle. struct ASTCallbackVHDenseMapInfo : public DenseMapInfo {}; - AliasAnalysis &AA; + AAResults &AA; MemorySSA *MSSA = nullptr; Loop *L = nullptr; ilist AliasSets; @@ -353,9 +356,9 @@ class AliasSetTracker { public: /// Create an empty collection of AliasSets, and use the specified alias /// analysis object to disambiguate load and store addresses. - explicit AliasSetTracker(AliasAnalysis &aa) : AA(aa) {} - explicit AliasSetTracker(AliasAnalysis &aa, MemorySSA *mssa, Loop *l) - : AA(aa), MSSA(mssa), L(l) {} + explicit AliasSetTracker(AAResults &AA) : AA(AA) {} + explicit AliasSetTracker(AAResults &AA, MemorySSA *MSSA, Loop *L) + : AA(AA), MSSA(MSSA), L(L) {} ~AliasSetTracker() { clear(); } /// These methods are used to add different types of instructions to the alias @@ -394,7 +397,7 @@ public: AliasSet &getAliasSetFor(const MemoryLocation &MemLoc); /// Return the underlying alias analysis object used by this tracker. - AliasAnalysis &getAliasAnalysis() const { return AA; } + AAResults &getAliasAnalysis() const { return AA; } /// This method is used to remove a pointer value from the AliasSetTracker /// entirely. It should be used when an instruction is deleted from the diff --git a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h index 3717fc9e2c36..7f3cbba0b6af 100644 --- a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h @@ -18,8 +18,6 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/AssumptionCache.h" -#include "llvm/Analysis/MemoryLocation.h" #include "llvm/IR/InstrTypes.h" #include "llvm/IR/PassManager.h" #include "llvm/Pass.h" diff --git a/llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h b/llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h index 156d5a560b9e..16c5f6701da0 100644 --- a/llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h +++ b/llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h @@ -23,7 +23,6 @@ #define LLVM_LIB_ANALYSIS_OBJCARCANALYSISUTILS_H #include "llvm/ADT/Optional.h" -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/ObjCARCInstKind.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/Constants.h" @@ -31,6 +30,9 @@ #include "llvm/IR/ValueHandle.h" namespace llvm { + +class AAResults; + namespace objcarc { /// A handy option to enable/disable all ARC Optimizations. @@ -161,24 +163,7 @@ inline bool IsPotentialRetainableObjPtr(const Value *Op) { return true; } -inline bool IsPotentialRetainableObjPtr(const Value *Op, - AliasAnalysis &AA) { - // First make the rudimentary check. - if (!IsPotentialRetainableObjPtr(Op)) - return false; - - // Objects in constant memory are not reference-counted. - if (AA.pointsToConstantMemory(Op)) - return false; - - // Pointers in constant memory are not pointing to reference-counted objects. - if (const LoadInst *LI = dyn_cast(Op)) - if (AA.pointsToConstantMemory(LI->getPointerOperand())) - return false; - - // Otherwise assume the worst. - return true; -} +bool IsPotentialRetainableObjPtr(const Value *Op, AAResults &AA); /// Helper for GetARCInstKind. Determines what kind of construct CS /// is. diff --git a/llvm/include/llvm/CodeGen/MachinePipeliner.h b/llvm/include/llvm/CodeGen/MachinePipeliner.h index 5ff1e3f87945..f89a453749e8 100644 --- a/llvm/include/llvm/CodeGen/MachinePipeliner.h +++ b/llvm/include/llvm/CodeGen/MachinePipeliner.h @@ -40,8 +40,6 @@ #ifndef LLVM_LIB_CODEGEN_MACHINEPIPELINER_H #define LLVM_LIB_CODEGEN_MACHINEPIPELINER_H -#include "llvm/Analysis/AliasAnalysis.h" - #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h" #include "llvm/CodeGen/RegisterClassInfo.h" @@ -51,6 +49,7 @@ namespace llvm { +class AAResults; class NodeSet; class SMSchedule; @@ -92,15 +91,7 @@ public: bool runOnMachineFunction(MachineFunction &MF) override; - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.addRequired(); - AU.addPreserved(); - AU.addRequired(); - AU.addRequired(); - AU.addRequired(); - AU.addRequired(); - MachineFunctionPass::getAnalysisUsage(AU); - } + void getAnalysisUsage(AnalysisUsage &AU) const override; private: void preprocessPhiNodes(MachineBasicBlock &B); @@ -285,7 +276,7 @@ public: static bool classof(const ScheduleDAGInstrs *DAG) { return true; } private: - void addLoopCarriedDependences(AliasAnalysis *AA); + void addLoopCarriedDependences(AAResults *AA); void updatePhiDependences(); void changeDependences(); unsigned calculateResMII(); diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h index 84677815533b..dbaf945986e4 100644 --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -102,7 +102,6 @@ #include "llvm/ADT/MapVector.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetVector.h" -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AssumeBundleQueries.h" #include "llvm/Analysis/CFG.h" #include "llvm/Analysis/CGSCCPassManager.h" @@ -128,6 +127,8 @@ struct AbstractAttribute; struct InformationCache; struct AAIsDead; +class AAManager; +class AAResults; class Function; /// The value passed to the line option that defines the maximal initialization @@ -863,9 +864,7 @@ struct InformationCache { } /// Return AliasAnalysis Result for function \p F. - AAResults *getAAResultsForFunction(const Function &F) { - return AG.getAnalysis(F); - } + AAResults *getAAResultsForFunction(const Function &F); /// Return true if \p Arg is involved in a must-tail call, thus the argument /// of the caller or callee. diff --git a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h index 5c12e5184716..951f4e487753 100644 --- a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h +++ b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h @@ -19,7 +19,6 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/BlockFrequencyInfo.h" #include "llvm/Analysis/BranchProbabilityInfo.h" #include "llvm/Analysis/DomTreeUpdater.h" @@ -29,6 +28,7 @@ namespace llvm { +class AAResults; class BasicBlock; class BinaryOperator; class BranchInst; @@ -41,6 +41,8 @@ class IntrinsicInst; class LazyValueInfo; class LoadInst; class PHINode; +class SelectInst; +class SwitchInst; class TargetLibraryInfo; class Value; @@ -77,7 +79,7 @@ enum ConstantPreference { WantInteger, WantBlockAddress }; class JumpThreadingPass : public PassInfoMixin { TargetLibraryInfo *TLI; LazyValueInfo *LVI; - AliasAnalysis *AA; + AAResults *AA; DomTreeUpdater *DTU; std::unique_ptr BFI; std::unique_ptr BPI; @@ -97,10 +99,10 @@ public: JumpThreadingPass(bool InsertFreezeWhenUnfoldingSelect = false, int T = -1); // Glue for old PM. - bool runImpl(Function &F, TargetLibraryInfo *TLI_, LazyValueInfo *LVI_, - AliasAnalysis *AA_, DomTreeUpdater *DTU_, bool HasProfileData_, - std::unique_ptr BFI_, - std::unique_ptr BPI_); + bool runImpl(Function &F, TargetLibraryInfo *TLI, LazyValueInfo *LVI, + AAResults *AA, DomTreeUpdater *DTU, bool HasProfileData, + std::unique_ptr BFI, + std::unique_ptr BPI); PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); diff --git a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h index 821de6c70aa0..7aca7abe8710 100644 --- a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h +++ b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h @@ -39,7 +39,7 @@ #include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/PriorityWorklist.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/BlockFrequencyInfo.h" #include "llvm/Analysis/GlobalsModRef.h" diff --git a/llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h b/llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h index 81a59c3d7772..635b706d0bef 100644 --- a/llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h +++ b/llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h @@ -14,7 +14,6 @@ #ifndef LLVM_TRANSFORMS_SCALAR_MEMCPYOPTIMIZER_H #define LLVM_TRANSFORMS_SCALAR_MEMCPYOPTIMIZER_H -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/PassManager.h" #include @@ -22,11 +21,14 @@ namespace llvm { +class AAResults; class AssumptionCache; +class CallBase; class CallInst; class DominatorTree; class Function; class Instruction; +class LoadInst; class MemCpyInst; class MemMoveInst; class MemoryDependenceResults; @@ -40,7 +42,7 @@ class Value; class MemCpyOptPass : public PassInfoMixin { MemoryDependenceResults *MD = nullptr; TargetLibraryInfo *TLI = nullptr; - AliasAnalysis *AA = nullptr; + AAResults *AA = nullptr; AssumptionCache *AC = nullptr; DominatorTree *DT = nullptr; MemorySSA *MSSA = nullptr; @@ -52,9 +54,9 @@ public: PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); // Glue for the old PM. - bool runImpl(Function &F, MemoryDependenceResults *MD_, - TargetLibraryInfo *TLI_, AliasAnalysis *AA_, - AssumptionCache *AC_, DominatorTree *DT_, MemorySSA *MSSA_); + bool runImpl(Function &F, MemoryDependenceResults *MD, TargetLibraryInfo *TLI, + AAResults *AA, AssumptionCache *AC, DominatorTree *DT, + MemorySSA *MSSA); private: // Helper functions diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp index c3d15655ab64..3d094a65a5e3 100644 --- a/llvm/lib/Analysis/AliasAnalysis.cpp +++ b/llvm/lib/Analysis/AliasAnalysis.cpp @@ -843,6 +843,13 @@ void AAResultsWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.addUsedIfAvailable(); } +AAManager::Result AAManager::run(Function &F, FunctionAnalysisManager &AM) { + Result R(AM.getResult(F)); + for (auto &Getter : ResultGetters) + (*Getter)(F, AM, R); + return R; +} + AAResults llvm::createLegacyPMAAResults(Pass &P, Function &F, BasicAAResult &BAR) { AAResults AAR(P.getAnalysis().getTLI(F)); diff --git a/llvm/lib/Analysis/IVDescriptors.cpp b/llvm/lib/Analysis/IVDescriptors.cpp index a5cc622279c4..c7e7ddbd8fc2 100644 --- a/llvm/lib/Analysis/IVDescriptors.cpp +++ b/llvm/lib/Analysis/IVDescriptors.cpp @@ -12,7 +12,6 @@ #include "llvm/Analysis/IVDescriptors.h" #include "llvm/ADT/ScopeExit.h" -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/DemandedBits.h" #include "llvm/Analysis/DomTreeUpdater.h" diff --git a/llvm/lib/Analysis/LoopAnalysisManager.cpp b/llvm/lib/Analysis/LoopAnalysisManager.cpp index 21017c04da99..4ad5641da147 100644 --- a/llvm/lib/Analysis/LoopAnalysisManager.cpp +++ b/llvm/lib/Analysis/LoopAnalysisManager.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/LoopAnalysisManager.h" +#include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/LoopInfo.h" diff --git a/llvm/lib/Analysis/ObjCARCAnalysisUtils.cpp b/llvm/lib/Analysis/ObjCARCAnalysisUtils.cpp index 56d1cb421225..d34a3c636362 100644 --- a/llvm/lib/Analysis/ObjCARCAnalysisUtils.cpp +++ b/llvm/lib/Analysis/ObjCARCAnalysisUtils.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/ObjCARCAnalysisUtils.h" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Support/CommandLine.h" using namespace llvm; @@ -23,3 +24,22 @@ bool llvm::objcarc::EnableARCOpts; static cl::opt EnableARCOptimizations( "enable-objc-arc-opts", cl::desc("enable/disable all ARC Optimizations"), cl::location(EnableARCOpts), cl::init(true), cl::Hidden); + +bool llvm::objcarc::IsPotentialRetainableObjPtr(const Value *Op, + AAResults &AA) { + // First make the rudimentary check. + if (!IsPotentialRetainableObjPtr(Op)) + return false; + + // Objects in constant memory are not reference-counted. + if (AA.pointsToConstantMemory(Op)) + return false; + + // Pointers in constant memory are not pointing to reference-counted objects. + if (const LoadInst *LI = dyn_cast(Op)) + if (AA.pointsToConstantMemory(LI->getPointerOperand())) + return false; + + // Otherwise assume the worst. + return true; +} diff --git a/llvm/lib/CodeGen/LiveRangeEdit.cpp b/llvm/lib/CodeGen/LiveRangeEdit.cpp index b77c4c414e8a..dbf02802d473 100644 --- a/llvm/lib/CodeGen/LiveRangeEdit.cpp +++ b/llvm/lib/CodeGen/LiveRangeEdit.cpp @@ -12,7 +12,6 @@ #include "llvm/CodeGen/LiveRangeEdit.h" #include "llvm/ADT/Statistic.h" -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/CodeGen/CalcSpillWeights.h" #include "llvm/CodeGen/LiveIntervals.h" #include "llvm/CodeGen/MachineRegisterInfo.h" diff --git a/llvm/lib/CodeGen/MachineFunctionPass.cpp b/llvm/lib/CodeGen/MachineFunctionPass.cpp index 03149aa7db4a..16cde1f601f9 100644 --- a/llvm/lib/CodeGen/MachineFunctionPass.cpp +++ b/llvm/lib/CodeGen/MachineFunctionPass.cpp @@ -11,7 +11,6 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/DominanceFrontier.h" #include "llvm/Analysis/GlobalsModRef.h" diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index a83c0154bd9f..c122800a196c 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -442,6 +442,16 @@ bool MachinePipeliner::swingModuloScheduler(MachineLoop &L) { return SMS.hasNewSchedule(); } +void MachinePipeliner::getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + AU.addPreserved(); + AU.addRequired(); + AU.addRequired(); + AU.addRequired(); + AU.addRequired(); + MachineFunctionPass::getAnalysisUsage(AU); +} + void SwingSchedulerDAG::setMII(unsigned ResMII, unsigned RecMII) { if (II_setByPragma > 0) MII = II_setByPragma; diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 6ce6e1093dc6..42cf81306f42 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -31,6 +31,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/MemoryLocation.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/VectorUtils.h" #include "llvm/CodeGen/DAGCombine.h" #include "llvm/CodeGen/ISDOpcodes.h" diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 65aaa8d21bfc..c1d2d8f1f39f 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -14,7 +14,6 @@ //===----------------------------------------------------------------------===// #include "llvm/LTO/LTOBackend.h" -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CGSCCPassManager.h" #include "llvm/Analysis/ModuleSummaryAnalysis.h" #include "llvm/Analysis/TargetLibraryInfo.h" diff --git a/llvm/lib/Target/ARM/ARMParallelDSP.cpp b/llvm/lib/Target/ARM/ARMParallelDSP.cpp index 730d6032dc55..9a3776fe64a7 100644 --- a/llvm/lib/Target/ARM/ARMParallelDSP.cpp +++ b/llvm/lib/Target/ARM/ARMParallelDSP.cpp @@ -22,6 +22,7 @@ #include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/LoopAccessAnalysis.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/CodeGen/TargetPassConfig.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicsARM.h" diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index 55eb42ee46cd..ab4ad7c784a4 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -1909,6 +1909,10 @@ void InformationCache::initializeInformationCache(const Function &CF, InlineableFunctions.insert(&F); } +AAResults *InformationCache::getAAResultsForFunction(const Function &F) { + return AG.getAnalysis(F); +} + InformationCache::FunctionInfo::~FunctionInfo() { // The instruction vectors are allocated using a BumpPtrAllocator, we need to // manually destroy them. diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index 4f08bd294978..536ecee1a3c4 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -16,6 +16,7 @@ #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AssumeBundleQueries.h" #include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/CaptureTracking.h" diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index 5350d85e11f3..1ba09817ee65 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -60,6 +60,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/OptimizationRemarkEmitter.h" #include "llvm/Analysis/TypeMetadataUtils.h" diff --git a/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp b/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp index c8f1c3f40e7b..7acbdb9f55b7 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp @@ -22,6 +22,7 @@ #include "llvm/Analysis/DomTreeUpdater.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/OptimizationRemarkEmitter.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Dominators.h" diff --git a/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp b/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp index 6a5e48b0a1d1..7f7f2dc89b7e 100644 --- a/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp +++ b/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp @@ -22,6 +22,7 @@ #include "DependencyAnalysis.h" #include "ObjCARC.h" #include "ProvenanceAnalysis.h" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/IR/CFG.h" using namespace llvm; diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARC.h b/llvm/lib/Transforms/ObjCARC/ObjCARC.h index b496842fcfc5..8227a8c6f75f 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARC.h +++ b/llvm/lib/Transforms/ObjCARC/ObjCARC.h @@ -23,9 +23,7 @@ #define LLVM_LIB_TRANSFORMS_OBJCARC_OBJCARC_H #include "llvm/Analysis/ObjCARCAnalysisUtils.h" -#include "llvm/Analysis/ObjCARCInstKind.h" #include "llvm/Transforms/Utils/Local.h" -#include "llvm/Transforms/ObjCARC.h" namespace llvm { namespace objcarc { diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp index 3904f4d57170..e190c46b613b 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp @@ -30,6 +30,7 @@ #include "ObjCARC.h" #include "ProvenanceAnalysis.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/EHPersonalities.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/InlineAsm.h" @@ -62,7 +63,7 @@ namespace { class ObjCARCContract { bool Changed; - AliasAnalysis *AA; + AAResults *AA; DominatorTree *DT; ProvenanceAnalysis PA; ARCRuntimeEntryPoints EP; @@ -195,7 +196,7 @@ bool ObjCARCContract::contractAutorelease(Function &F, Instruction *Autorelease, static StoreInst *findSafeStoreForStoreStrongContraction(LoadInst *Load, Instruction *Release, ProvenanceAnalysis &PA, - AliasAnalysis *AA) { + AAResults *AA) { StoreInst *Store = nullptr; bool SawRelease = false; diff --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp index 73287c7441e9..3e3d3032f445 100644 --- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp +++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp @@ -12,6 +12,7 @@ #include "llvm/Transforms/Scalar/LoopRotation.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/MemorySSA.h" diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index bfd8f00c228e..ddd8856e92c5 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -75,6 +75,7 @@ #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/ScalarEvolutionNormalization.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/BasicBlock.h" diff --git a/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp b/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp index 0c43c1e1ac2a..a2b72e4e7f03 100644 --- a/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp +++ b/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp @@ -16,6 +16,7 @@ #include "llvm/Analysis/DemandedBits.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/OptimizationRemarkEmitter.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/VectorUtils.h" #include "llvm/IR/InstIterator.h" #include "llvm/IR/IntrinsicInst.h" diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp index 9badbdf64932..261c658ab544 100644 --- a/llvm/tools/opt/NewPMDriver.cpp +++ b/llvm/tools/opt/NewPMDriver.cpp @@ -16,7 +16,6 @@ #include "PassPrinters.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CGSCCPassManager.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Bitcode/BitcodeWriterPass.h" diff --git a/llvm/unittests/Analysis/AliasSetTrackerTest.cpp b/llvm/unittests/Analysis/AliasSetTrackerTest.cpp index 30be6acad0fa..625971b1db07 100644 --- a/llvm/unittests/Analysis/AliasSetTrackerTest.cpp +++ b/llvm/unittests/Analysis/AliasSetTrackerTest.cpp @@ -9,6 +9,7 @@ #include "llvm/Analysis/AliasSetTracker.h" #include "llvm/ADT/Triple.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TypeBasedAliasAnalysis.h" #include "llvm/AsmParser/Parser.h" #include "llvm/IR/LLVMContext.h" diff --git a/llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp b/llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp index f69d2d14a6c0..5b8ece41b07c 100644 --- a/llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp +++ b/llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp @@ -11,6 +11,8 @@ #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/AssumptionCache.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/AsmParser/Parser.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/IRBuilder.h" diff --git a/llvm/unittests/Analysis/DDGTest.cpp b/llvm/unittests/Analysis/DDGTest.cpp index 1be16e56cb9c..9919d055d01a 100644 --- a/llvm/unittests/Analysis/DDGTest.cpp +++ b/llvm/unittests/Analysis/DDGTest.cpp @@ -8,6 +8,7 @@ #include "llvm/Analysis/DDG.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/ScalarEvolution.h" diff --git a/llvm/unittests/Analysis/GlobalsModRefTest.cpp b/llvm/unittests/Analysis/GlobalsModRefTest.cpp index 21f78712c7d3..5066d748e11f 100644 --- a/llvm/unittests/Analysis/GlobalsModRefTest.cpp +++ b/llvm/unittests/Analysis/GlobalsModRefTest.cpp @@ -9,6 +9,7 @@ #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/ADT/Triple.h" #include "llvm/Analysis/CallGraph.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/AsmParser/Parser.h" #include "llvm/Support/SourceMgr.h" #include "gtest/gtest.h" diff --git a/llvm/unittests/Analysis/MemorySSATest.cpp b/llvm/unittests/Analysis/MemorySSATest.cpp index b80ee3b229c7..f34677997010 100644 --- a/llvm/unittests/Analysis/MemorySSATest.cpp +++ b/llvm/unittests/Analysis/MemorySSATest.cpp @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/MemorySSA.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/MemorySSAUpdater.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Dominators.h" diff --git a/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp b/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp index c7e63d4a38fc..300f9c22555a 100644 --- a/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp +++ b/llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp @@ -12,6 +12,7 @@ #include "llvm/Analysis/DependenceAnalysis.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/PostDominators.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/AsmParser/Parser.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/LLVMContext.h" diff --git a/llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp index 2d868d3cd8af..268f43774d12 100644 --- a/llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp +++ b/llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp @@ -9,6 +9,7 @@ #include "../lib/Transforms/Vectorize/VPlan.h" #include "../lib/Transforms/Vectorize/VPlanHCFGBuilder.h" #include "VPlanTestBase.h" +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/VectorUtils.h" #include "gtest/gtest.h" diff --git a/polly/include/polly/ScopBuilder.h b/polly/include/polly/ScopBuilder.h index e1d1c7849450..7bed07c36c52 100644 --- a/polly/include/polly/ScopBuilder.h +++ b/polly/include/polly/ScopBuilder.h @@ -31,8 +31,8 @@ extern bool ModelReadOnlyScalars; /// Build the Polly IR (Scop and ScopStmt) on a Region. class ScopBuilder { - /// The AliasAnalysis to build AliasSetTracker. - AliasAnalysis &AA; + /// The AAResults to build AliasSetTracker. + AAResults &AA; /// Target data for element size computing. const DataLayout &DL; @@ -823,7 +823,7 @@ class ScopBuilder { void buildSchedule(RegionNode *RN, LoopStackTy &LoopStack); public: - explicit ScopBuilder(Region *R, AssumptionCache &AC, AliasAnalysis &AA, + explicit ScopBuilder(Region *R, AssumptionCache &AC, AAResults &AA, const DataLayout &DL, DominatorTree &DT, LoopInfo &LI, ScopDetection &SD, ScalarEvolution &SE, OptimizationRemarkEmitter &ORE); diff --git a/polly/include/polly/ScopDetection.h b/polly/include/polly/ScopDetection.h index ead8079d2e2e..f28ab498c83f 100644 --- a/polly/include/polly/ScopDetection.h +++ b/polly/include/polly/ScopDetection.h @@ -48,7 +48,6 @@ #include "polly/ScopDetectionDiagnostic.h" #include "polly/Support/ScopHelper.h" -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasSetTracker.h" #include "llvm/Analysis/RegionInfo.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" @@ -58,6 +57,8 @@ using namespace llvm; namespace llvm { +class AAResults; + void initializeScopDetectionWrapperPassPass(PassRegistry &); } // namespace llvm @@ -161,7 +162,7 @@ public: MapInsnToMemAcc InsnToMemAcc; /// Initialize a DetectionContext from scratch. - DetectionContext(Region &R, AliasAnalysis &AA, bool Verify) + DetectionContext(Region &R, AAResults &AA, bool Verify) : CurRegion(R), AST(AA), Verifying(Verify), Log(&R) {} /// Initialize a DetectionContext with the data from @p DC. @@ -197,7 +198,7 @@ private: ScalarEvolution &SE; LoopInfo &LI; RegionInfo &RI; - AliasAnalysis &AA; + AAResults &AA; //@} /// Map to remember detection contexts for all regions. @@ -518,7 +519,7 @@ private: public: ScopDetection(Function &F, const DominatorTree &DT, ScalarEvolution &SE, - LoopInfo &LI, RegionInfo &RI, AliasAnalysis &AA, + LoopInfo &LI, RegionInfo &RI, AAResults &AA, OptimizationRemarkEmitter &ORE); /// Get the RegionInfo stored in this pass. diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index 5d18582a07ed..cdc70e00fa88 100644 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -1901,7 +1901,7 @@ private: //@} /// Initialize this ScopBuilder. - void init(AliasAnalysis &AA, AssumptionCache &AC, DominatorTree &DT, + void init(AAResults &AA, AssumptionCache &AC, DominatorTree &DT, LoopInfo &LI); /// Add parameter constraints to @p C that imply a non-empty domain. @@ -2737,15 +2737,15 @@ private: ScopDetection &SD; ScalarEvolution &SE; LoopInfo &LI; - AliasAnalysis &AA; + AAResults &AA; DominatorTree &DT; AssumptionCache &AC; OptimizationRemarkEmitter &ORE; public: ScopInfo(const DataLayout &DL, ScopDetection &SD, ScalarEvolution &SE, - LoopInfo &LI, AliasAnalysis &AA, DominatorTree &DT, - AssumptionCache &AC, OptimizationRemarkEmitter &ORE); + LoopInfo &LI, AAResults &AA, DominatorTree &DT, AssumptionCache &AC, + OptimizationRemarkEmitter &ORE); /// Get the Scop object for the given Region. ///