File tree 2 files changed +9
-10
lines changed
Filter options
2 files changed +9
-10
lines changed
Original file line number Diff line number Diff line change 33
33
#define LLVM_CODEGEN_GCMETADATA_H
34
34
35
35
#include " llvm/ADT/DenseMap.h"
36
+ #include " llvm/ADT/MapVector.h"
36
37
#include " llvm/ADT/SmallVector.h"
37
38
#include " llvm/ADT/StringMap.h"
38
39
#include " llvm/ADT/StringRef.h"
@@ -151,9 +152,9 @@ class GCFunctionInfo {
151
152
size_t live_size (const iterator &p) const { return roots_size (); }
152
153
};
153
154
154
- struct GCStrategyMap {
155
- StringMap<std::unique_ptr<GCStrategy >> StrategyMap;
156
-
155
+ class GCStrategyMap : public MapVector <std::string, std::unique_ptr<GCStrategy>,
156
+ StringMap<unsigned >> {
157
+ public:
157
158
GCStrategyMap () = default ;
158
159
GCStrategyMap (GCStrategyMap &&) = default ;
159
160
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ bool GCStrategyMap::invalidate(Module &M, const PreservedAnalyses &PA,
26
26
for (const auto &F : M) {
27
27
if (F.isDeclaration () || !F.hasGC ())
28
28
continue ;
29
- if (!StrategyMap. contains (F.getGC ()))
29
+ if (!contains (F.getGC ()))
30
30
return true ;
31
31
}
32
32
return false ;
@@ -36,17 +36,16 @@ AnalysisKey CollectorMetadataAnalysis::Key;
36
36
37
37
CollectorMetadataAnalysis::Result
38
38
CollectorMetadataAnalysis::run (Module &M, ModuleAnalysisManager &MAM) {
39
- Result R;
40
- auto &Map = R.StrategyMap ;
39
+ Result StrategyMap;
41
40
for (auto &F : M) {
42
41
if (F.isDeclaration () || !F.hasGC ())
43
42
continue ;
44
43
auto GCName = F.getGC ();
45
- auto [It, Inserted] = Map .try_emplace (GCName);
44
+ auto [It, Inserted] = StrategyMap .try_emplace (GCName);
46
45
if (Inserted)
47
46
It->second = getGCStrategy (GCName);
48
47
}
49
- return R ;
48
+ return StrategyMap ;
50
49
}
51
50
52
51
AnalysisKey GCFunctionAnalysis::Key;
@@ -61,8 +60,7 @@ GCFunctionAnalysis::run(Function &F, FunctionAnalysisManager &FAM) {
61
60
MAMProxy.cachedResultExists <CollectorMetadataAnalysis>(*F.getParent ()) &&
62
61
" This pass need module analysis `collector-metadata`!" );
63
62
auto &Map =
64
- MAMProxy.getCachedResult <CollectorMetadataAnalysis>(*F.getParent ())
65
- ->StrategyMap ;
63
+ *MAMProxy.getCachedResult <CollectorMetadataAnalysis>(*F.getParent ());
66
64
GCFunctionInfo Info (F, *Map[F.getGC ()]);
67
65
return Info;
68
66
}
You can’t perform that action at this time.
0 commit comments