Lines Matching refs:GV
52 GlobalValue *GV = cast<GlobalValue>(Operand); in FindUsedValues() local
53 UsedValues.insert(GV); in FindUsedValues()
69 static bool hasMetadataOtherThanDebugLoc(const GlobalVariable *GV) { in hasMetadataOtherThanDebugLoc() argument
71 GV->getAllMetadata(MDs); in hasMetadataOtherThanDebugLoc()
86 static Align getAlign(GlobalVariable *GV) { in getAlign() argument
87 return GV->getAlign().value_or( in getAlign()
88 GV->getDataLayout().getPreferredAlign(GV)); in getAlign()
92 isUnmergeableGlobal(GlobalVariable *GV, in isUnmergeableGlobal() argument
95 return !GV->isConstant() || !GV->hasDefinitiveInitializer() || in isUnmergeableGlobal()
96 GV->getType()->getAddressSpace() != 0 || GV->hasSection() || in isUnmergeableGlobal()
98 GV->isThreadLocal() || in isUnmergeableGlobal()
100 UsedGlobals.count(GV); in isUnmergeableGlobal()
155 for (GlobalVariable &GV : llvm::make_early_inc_range(M.globals())) { in mergeConstants()
157 GV.removeDeadConstantUsers(); in mergeConstants()
158 if (GV.use_empty() && GV.hasLocalLinkage()) { in mergeConstants()
159 GV.eraseFromParent(); in mergeConstants()
164 if (isUnmergeableGlobal(&GV, UsedGlobals)) in mergeConstants()
171 if (GV.isWeakForLinker()) in mergeConstants()
175 if (hasMetadataOtherThanDebugLoc(&GV)) in mergeConstants()
178 Constant *Init = GV.getInitializer(); in mergeConstants()
187 if (FirstConstantFound || IsBetterCanonical(GV, *Slot)) { in mergeConstants()
188 Slot = &GV; in mergeConstants()
189 LLVM_DEBUG(dbgs() << "Cmap[" << *Init << "] = " << GV.getName() in mergeConstants()
198 for (GlobalVariable &GV : llvm::make_early_inc_range(M.globals())) { in mergeConstants()
199 if (isUnmergeableGlobal(&GV, UsedGlobals)) in mergeConstants()
203 if (!GV.hasLocalLinkage()) in mergeConstants()
206 Constant *Init = GV.getInitializer(); in mergeConstants()
214 if (Slot == &GV) in mergeConstants()
217 if (makeMergeable(&GV, Slot) == CanMerge::No) in mergeConstants()
221 LLVM_DEBUG(dbgs() << "Will replace: @" << GV.getName() << " -> @" in mergeConstants()
223 SameContentReplacements.push_back(std::make_pair(&GV, Slot)); in mergeConstants()