================ @@ -4347,6 +4362,19 @@ void CodeGenModule::emitCPUDispatchDefinition(GlobalDecl GD) { } } +/// Adds a declaration to the list of multi version functions if not present. +void CodeGenModule::AddDeferredMultiVersionResolverToEmit(GlobalDecl GD) { + const auto *FD = cast<FunctionDecl>(GD.getDecl()); + assert(FD && "Not a FunctionDecl?"); + + if (FD->isTargetVersionMultiVersion()) { + StringRef NamePrefix = getMangledName(GD).split('.').first; ---------------- labrinea wrote:
Initially I was using `FD->getName()` as the key here but this wouldn't work for C++ mangled names. `getMangledName()` internally calls `getMangledNameImpl()` which returns the multi versioned name (this would be "foo.bar.baz._Mlse" in you example). The key needs to be the prefix "foo.bar.baz" so that we don't push every multi version of "foo.bar.baz" in the list `MultiVersionFuncs` to be processed by `emitMultiVersionFunctions()`. This would generate a resolver body with multiple copies of the basic blocks corresponding to each version. Hmm, I am not sure how to handle this example properly, perhaps with `rsplit()`. https://github.com/llvm/llvm-project/pull/84405 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits