[llvm] [CloneModule] Clone undefined ifuncs (PR #197353)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed May 13 04:35:54 PDT 2026
================
@@ -117,6 +117,18 @@ std::unique_ptr<Module> llvm::CloneModule(
for (const GlobalIFunc &I : M.ifuncs()) {
// Defer setting the resolver function until after functions are cloned.
+ if (!ShouldCloneDefinition(&I)) {
+ // An ifunc also cannot act as an external reference, so we need to create
+ // a function depending on the value type.
+ GlobalValue *GV;
+ assert(I.getValueType()->isFunctionTy() &&
+ "IFunc resolver must be function type!");
+ GV = Function::Create(cast<FunctionType>(I.getValueType()),
+ GlobalValue::ExternalLinkage, I.getAddressSpace(),
----------------
arsenm wrote:
Should this preserve the linkage of the original value?
https://github.com/llvm/llvm-project/pull/197353
More information about the llvm-commits
mailing list