@@ -105,7 +105,8 @@ static void findPartitions(Module &M, ClusterIDMapType &ClusterIDMap,
105
105
// At this point module should have the proper mix of globals and locals.
106
106
// As we attempt to partition this module, we must not change any
107
107
// locals to globals.
108
- LLVM_DEBUG (dbgs () << " Partition module with (" << M.size () << " )functions\n " );
108
+ LLVM_DEBUG (dbgs () << " Partition module with (" << M.size ()
109
+ << " ) functions\n " );
109
110
ClusterMapType GVtoClusterMap;
110
111
ComdatMembersType ComdatMembers;
111
112
@@ -164,10 +165,10 @@ static void findPartitions(Module &M, ClusterIDMapType &ClusterIDMap,
164
165
std::priority_queue<std::pair<unsigned , unsigned >,
165
166
std::vector<std::pair<unsigned , unsigned >>,
166
167
decltype (CompareClusters)>
167
- BalancinQueue (CompareClusters);
168
+ BalancingQueue (CompareClusters);
168
169
// Pre-populate priority queue with N slot blanks.
169
170
for (unsigned i = 0 ; i < N; ++i)
170
- BalancinQueue .push (std::make_pair (i, 0 ));
171
+ BalancingQueue .push (std::make_pair (i, 0 ));
171
172
172
173
using SortType = std::pair<unsigned , ClusterMapType::iterator>;
173
174
@@ -177,11 +178,13 @@ static void findPartitions(Module &M, ClusterIDMapType &ClusterIDMap,
177
178
// To guarantee determinism, we have to sort SCC according to size.
178
179
// When size is the same, use leader's name.
179
180
for (ClusterMapType::iterator I = GVtoClusterMap.begin (),
180
- E = GVtoClusterMap.end (); I != E; ++I)
181
+ E = GVtoClusterMap.end ();
182
+ I != E; ++I)
181
183
if (I->isLeader ())
182
184
Sets.push_back (
183
185
std::make_pair (std::distance (GVtoClusterMap.member_begin (I),
184
- GVtoClusterMap.member_end ()), I));
186
+ GVtoClusterMap.member_end ()),
187
+ I));
185
188
186
189
llvm::sort (Sets, [](const SortType &a, const SortType &b) {
187
190
if (a.first == b.first )
@@ -191,9 +194,9 @@ static void findPartitions(Module &M, ClusterIDMapType &ClusterIDMap,
191
194
});
192
195
193
196
for (auto &I : Sets) {
194
- unsigned CurrentClusterID = BalancinQueue .top ().first ;
195
- unsigned CurrentClusterSize = BalancinQueue .top ().second ;
196
- BalancinQueue .pop ();
197
+ unsigned CurrentClusterID = BalancingQueue .top ().first ;
198
+ unsigned CurrentClusterSize = BalancingQueue .top ().second ;
199
+ BalancingQueue .pop ();
197
200
198
201
LLVM_DEBUG (dbgs () << " Root[" << CurrentClusterID << " ] cluster_size("
199
202
<< I.first << " ) ----> " << I.second ->getData ()->getName ()
@@ -211,7 +214,7 @@ static void findPartitions(Module &M, ClusterIDMapType &ClusterIDMap,
211
214
CurrentClusterSize++;
212
215
}
213
216
// Add this set size to the number of entries in this cluster.
214
- BalancinQueue .push (std::make_pair (CurrentClusterID, CurrentClusterSize));
217
+ BalancingQueue .push (std::make_pair (CurrentClusterID, CurrentClusterSize));
215
218
}
216
219
}
217
220
@@ -275,8 +278,8 @@ void llvm::SplitModule(
275
278
ValueToValueMapTy VMap;
276
279
std::unique_ptr<Module> MPart (
277
280
CloneModule (M, VMap, [&](const GlobalValue *GV) {
278
- if (ClusterIDMap.count (GV))
279
- return (ClusterIDMap[GV] == I) ;
281
+ if (auto It = ClusterIDMap.find (GV); It != ClusterIDMap. end ( ))
282
+ return It-> second == I;
280
283
else
281
284
return isInPartition (GV, I, N);
282
285
}));
0 commit comments