mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
[PM] Split the AssumptionTracker immutable pass into two separate APIs:
a cache of assumptions for a single function, and an immutable pass that manages those caches. The motivation for this change is two fold. Immutable analyses are really hacks around the current pass manager design and don't exist in the new design. This is usually OK, but it requires that the core logic of an immutable pass be reasonably partitioned off from the pass logic. This change does precisely that. As a consequence it also paves the way for the *many* utility functions that deal in the assumptions to live in both pass manager worlds by creating an separate non-pass object with its own independent API that they all rely on. Now, the only bits of the system that deal with the actual pass mechanics are those that actually need to deal with the pass mechanics. Once this separation is made, several simplifications become pretty obvious in the assumption cache itself. Rather than using a set and callback value handles, it can just be a vector of weak value handles. The callers can easily skip the handles that are null, and eventually we can wrap all of this up behind a filter iterator. For now, this adds boiler plate to the various passes, but this kind of boiler plate will end up making it possible to port these passes to the new pass manager, and so it will end up factored away pretty reasonably. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225131 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -55,7 +55,7 @@
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/AliasSetTracker.h"
|
||||
#include "llvm/Analysis/AssumptionTracker.h"
|
||||
#include "llvm/Analysis/AssumptionCache.h"
|
||||
#include "llvm/Analysis/BlockFrequencyInfo.h"
|
||||
#include "llvm/Analysis/CodeMetrics.h"
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
@ -908,11 +908,11 @@ public:
|
||||
LoopVectorizationLegality *Legal,
|
||||
const TargetTransformInfo &TTI,
|
||||
const DataLayout *DL, const TargetLibraryInfo *TLI,
|
||||
AssumptionTracker *AT, const Function *F,
|
||||
AssumptionCache *AC, const Function *F,
|
||||
const LoopVectorizeHints *Hints)
|
||||
: TheLoop(L), SE(SE), LI(LI), Legal(Legal), TTI(TTI), DL(DL), TLI(TLI),
|
||||
TheFunction(F), Hints(Hints) {
|
||||
CodeMetrics::collectEphemeralValues(L, AT, EphValues);
|
||||
CodeMetrics::collectEphemeralValues(L, AC, EphValues);
|
||||
}
|
||||
|
||||
/// Information about vectorization costs
|
||||
@ -1267,7 +1267,7 @@ struct LoopVectorize : public FunctionPass {
|
||||
BlockFrequencyInfo *BFI;
|
||||
TargetLibraryInfo *TLI;
|
||||
AliasAnalysis *AA;
|
||||
AssumptionTracker *AT;
|
||||
AssumptionCache *AC;
|
||||
bool DisableUnrolling;
|
||||
bool AlwaysVectorize;
|
||||
|
||||
@ -1283,7 +1283,7 @@ struct LoopVectorize : public FunctionPass {
|
||||
BFI = &getAnalysis<BlockFrequencyInfo>();
|
||||
TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
|
||||
AA = &getAnalysis<AliasAnalysis>();
|
||||
AT = &getAnalysis<AssumptionTracker>();
|
||||
AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
|
||||
|
||||
// Compute some weights outside of the loop over the loops. Compute this
|
||||
// using a BranchProbability to re-use its scaling math.
|
||||
@ -1402,7 +1402,7 @@ struct LoopVectorize : public FunctionPass {
|
||||
}
|
||||
|
||||
// Use the cost model.
|
||||
LoopVectorizationCostModel CM(L, SE, LI, &LVL, *TTI, DL, TLI, AT, F,
|
||||
LoopVectorizationCostModel CM(L, SE, LI, &LVL, *TTI, DL, TLI, AC, F,
|
||||
&Hints);
|
||||
|
||||
// Check the function attributes to find out if this function should be
|
||||
@ -1490,7 +1490,7 @@ struct LoopVectorize : public FunctionPass {
|
||||
}
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
AU.addRequired<AssumptionTracker>();
|
||||
AU.addRequired<AssumptionCacheTracker>();
|
||||
AU.addRequiredID(LoopSimplifyID);
|
||||
AU.addRequiredID(LCSSAID);
|
||||
AU.addRequired<BlockFrequencyInfo>();
|
||||
@ -6145,7 +6145,7 @@ static const char lv_name[] = "Loop Vectorization";
|
||||
INITIALIZE_PASS_BEGIN(LoopVectorize, LV_NAME, lv_name, false, false)
|
||||
INITIALIZE_AG_DEPENDENCY(TargetTransformInfo)
|
||||
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
||||
INITIALIZE_PASS_DEPENDENCY(AssumptionTracker)
|
||||
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
|
||||
INITIALIZE_PASS_DEPENDENCY(BlockFrequencyInfo)
|
||||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
||||
INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
|
||||
|
Reference in New Issue
Block a user