Lines Matching defs:GV
73 const GlobalValue *GV, const User *U) {
78 GVtoClusterMap.unionSets(GV, F);
80 GVtoClusterMap.unionSets(GV, GVU);
86 // Adds all GlobalValue users of V to the same cluster as GV.
88 const GlobalValue *GV, const Value *V) {
94 // For each constant that is not a GV (a pure const) recurse.
99 addNonConstUser(GVtoClusterMap, GV, UU);
104 static const GlobalObject *getGVPartitioningRoot(const GlobalValue *GV) {
105 const GlobalObject *GO = GV->getAliaseeObject();
125 auto recordGVSet = [&GVtoClusterMap, &ComdatMembers](GlobalValue &GV) {
126 if (GV.isDeclaration())
129 if (!GV.hasName())
130 GV.setName("__llvmsplit_unnamed");
136 if (const Comdat *C = GV.getComdat()) {
139 GVtoClusterMap.unionSets(Member, &GV);
141 Member = &GV;
146 if (const GlobalObject *Root = getGVPartitioningRoot(&GV))
147 if (&GV != Root)
148 GVtoClusterMap.unionSets(&GV, Root);
150 if (const Function *F = dyn_cast<Function>(&GV)) {
159 if (GV.hasLocalLinkage())
160 addAllGlobalValueUsers(GVtoClusterMap, &GV, &GV);
222 static void externalize(GlobalValue *GV) {
223 if (GV->hasLocalLinkage()) {
224 GV->setLinkage(GlobalValue::ExternalLinkage);
225 GV->setVisibility(GlobalValue::HiddenVisibility);
230 if (!GV->hasName())
231 GV->setName("__llvmsplit_unnamed");
234 // Returns whether GV should be in partition (0-based) I of N.
235 static bool isInPartition(const GlobalValue *GV, unsigned I, unsigned N) {
236 if (const GlobalObject *Root = getGVPartitioningRoot(GV))
237 GV = Root;
240 if (const Comdat *C = GV->getComdat())
243 Name = GV->getName();
262 for (GlobalVariable &GV : M.globals())
263 externalize(&GV);
316 CloneModule(M, VMap, [&](const GlobalValue *GV) {
317 if (auto It = ClusterIDMap.find(GV); It != ClusterIDMap.end())
320 return isInPartition(GV, I, N);