[llvm] [CloneModule] Clone undefined ifuncs (PR #197353)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 14 00:10:44 PDT 2026


================
@@ -117,6 +117,22 @@ 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
+      // either a function or a global variable depending on the value type.
+      GlobalValue *GV;
+      if (I.getValueType()->isFunctionTy())
+        GV = Function::Create(cast<FunctionType>(I.getValueType()),
----------------
mmjjpp wrote:

Yes, this should be a function, and it has been modified now.

https://github.com/llvm/llvm-project/pull/197353


More information about the llvm-commits mailing list