forked from OSchip/llvm-project
[SLP] Use BatchAA to reduce capture analysis cost [NFC]
SLP makes very heavy use of aliasing queries to construct pointer dependencies for scheduling purposes. AA internally usings pointerMayBeCaptured to prove some noalias results. In a local profile, we were spending about 4% of total O2 time in capture tracking. By using BatchAA interface - which caches capture results - this drops to 2%. Note that there is no invalidation of BatchAA here. This assumes that no transformation done by SLP invalidates alias or capture results. This is the same assumption made by the existing AliasCache, so this is not a new assumption in the code.
This commit is contained in:
parent
49b23f451c
commit
33ce97f413
|
@ -792,8 +792,8 @@ public:
|
|||
TargetLibraryInfo *TLi, AAResults *Aa, LoopInfo *Li,
|
||||
DominatorTree *Dt, AssumptionCache *AC, DemandedBits *DB,
|
||||
const DataLayout *DL, OptimizationRemarkEmitter *ORE)
|
||||
: F(Func), SE(Se), TTI(Tti), TLI(TLi), AA(Aa), LI(Li), DT(Dt), AC(AC),
|
||||
DB(DB), DL(DL), ORE(ORE), Builder(Se->getContext()) {
|
||||
: BatchAA(*Aa), F(Func), SE(Se), TTI(Tti), TLI(TLi), AA(Aa), LI(Li),
|
||||
DT(Dt), AC(AC), DB(DB), DL(DL), ORE(ORE), Builder(Se->getContext()) {
|
||||
CodeMetrics::collectEphemeralValues(F, AC, EphValues);
|
||||
// Use the vector register size specified by the target unless overridden
|
||||
// by a command-line option.
|
||||
|
@ -2392,7 +2392,7 @@ private:
|
|||
}
|
||||
bool aliased = true;
|
||||
if (Loc1.Ptr && isSimple(Inst1))
|
||||
aliased = isModOrRefSet(AA->getModRefInfo(Inst2, Loc1));
|
||||
aliased = isModOrRefSet(BatchAA.getModRefInfo(Inst2, Loc1));
|
||||
// Store the result in the cache.
|
||||
result = aliased;
|
||||
return aliased;
|
||||
|
@ -2404,6 +2404,11 @@ private:
|
|||
/// TODO: consider moving this to the AliasAnalysis itself.
|
||||
DenseMap<AliasCacheKey, Optional<bool>> AliasCache;
|
||||
|
||||
// Cache for pointerMayBeCaptured calls inside AA. This is preserved
|
||||
// globally through SLP because we don't perform any action which
|
||||
// invalidates capture results.
|
||||
BatchAAResults BatchAA;
|
||||
|
||||
/// Removes an instruction from its block and eventually deletes it.
|
||||
/// It's like Instruction::eraseFromParent() except that the actual deletion
|
||||
/// is delayed until BoUpSLP is destructed.
|
||||
|
|
Loading…
Reference in New Issue