================
@@ -671,3 +672,80 @@ void GlobalIFunc::applyAlongResolverPath(
DenseSet<const GlobalAlias *> Aliases;
findBaseObject(getResolver(), Aliases, Op);
}
+
+static void collectUsedGlobals(GlobalVariable *GV,
+ SmallSetVector<Constant *, 16> &Init) {
+ if (!GV || !GV->hasInitializer())
+ return;
+
+ auto *CA = cast<ConstantArray>(GV->getInitializer());
+ for (Use &Op : CA->operands())
+ Init.insert(cast<Constant>(Op));
+}
+
+static void appendToUsedList(Module &M, StringRef Name,
+ ArrayRef<GlobalValue *> Values) {
+ GlobalVariable *GV = M.getGlobalVariable(Name);
+
+ SmallSetVector<Constant *, 16> Init;
+ collectUsedGlobals(GV, Init);
+ Type *ArrayEltTy = GV ? GV->getValueType()->getArrayElementType()
+ : PointerType::getUnqual(M.getContext());
----------------
jmmartinez wrote:
I've updated the PR since https://github.com/llvm/llvm-project/pull/164432
landed first. Now we should only handle the `Unqual`.
https://github.com/llvm/llvm-project/pull/162660
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits