LLVM: lib/Analysis/LoopAnalysisManager.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
17#include
18
19using namespace llvm;
20
21namespace llvm {
22
23
31
32bool LoopAnalysisManagerFunctionProxy::Result::invalidate(
34 FunctionAnalysisManager::Invalidator &Inv) {
35
36
37
38
39
41
42
43
44
45
46
47
48
49
50 auto PAC = PA.getChecker();
51 bool invalidateMemorySSAAnalysis = false;
52 if (MSSAUsed)
53 invalidateMemorySSAAnalysis = Inv.invalidate<MemorySSAAnalysis>(F, PA);
60 invalidateMemorySSAAnalysis) {
61
62
63
64
65
66 for (Loop *L : PreOrderLoops) {
67
68 InnerAM->clear(*L, "");
69 }
70
71
72
73
74
75
76
77
78 InnerAM = nullptr;
79
80
81
82 return true;
83 }
84
85
86
87 bool AreLoopAnalysesPreserved =
89
90
91
92
93
94
95
97 std::optional InnerPA;
98
99
100
101
102 if (auto *OuterProxy =
104 for (const auto &OuterInvalidationPair :
105 OuterProxy->getOuterInvalidations()) {
106 AnalysisKey *OuterAnalysisID = OuterInvalidationPair.first;
107 const auto &InnerAnalysisIDs = OuterInvalidationPair.second;
108 if (Inv.invalidate(OuterAnalysisID, F, PA)) {
109 if (!InnerPA)
110 InnerPA = PA;
111 for (AnalysisKey *InnerAnalysisID : InnerAnalysisIDs)
112 InnerPA->abandon(InnerAnalysisID);
113 }
114 }
115
116
117
118 if (InnerPA) {
119 InnerAM->invalidate(*L, *InnerPA);
120 continue;
121 }
122
123
124
125 if (!AreLoopAnalysesPreserved)
126 InnerAM->invalidate(*L, PA);
127 }
128
129
130 return false;
131}
132
133template <>
134LoopAnalysisManagerFunctionProxy::Result
138}
139}
140
145 PA.preserve();
147 return PA;
148}
#define LLVM_EXPORT_TEMPLATE
This header provides classes for managing per-loop analyses.
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
Provides implementations for PassManager and AnalysisManager template methods.
A manager for alias analyses.
This templated class represents "all analyses that operate over " (e....
A container for analyses that lazily runs them and caches their results.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
A function analysis which provides an AssumptionCache.
Analysis pass which computes a DominatorTree.
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...
Result run(Function &IR, AnalysisManager< Function, ExtraArgTs... > &AM, ExtraArgTs...)
Analysis pass that exposes the LoopInfo for a function.
Represents a single loop in the control flow graph.
An analysis that produces MemorySSA for a function.
An analysis over an "inner" IR unit that provides access to an analysis manager over a "outer" IR uni...
A set of analyses that are preserved following a run of a transformation pass.
bool allAnalysesInSetPreserved() const
Directly test whether a set of analyses is preserved.
PreservedAnalyses & preserve()
Mark an analysis as preserved.
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
Analysis pass that exposes the ScalarEvolution for a function.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
auto reverse(ContainerTy &&C)
OuterAnalysisManagerProxy< FunctionAnalysisManager, Loop, LoopStandardAnalysisResults & > FunctionAnalysisManagerLoopProxy
A proxy from a FunctionAnalysisManager to a Loop.
LLVM_ABI PreservedAnalyses getLoopPassPreservedAnalyses()
Returns the minimum set of Analyses that all loop passes must preserve.
Definition LoopAnalysisManager.cpp:141
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A special type used by analysis passes to provide an address that identifies that particular analysis...
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...