================
@@ -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;
----------------
jroelofs wrote:

`asm`+multiversioning isn't really the point of that argument... sorry, bad 
example. My point is that the `.` inserted for multi versioning mangling might 
not be the only one. If you insist on string splitting, it should at least be 
`rsplit`.

We shouldn't have to rely on string splitting though: `getMangledNameImpl(..., 
false)` returns the prefix that you need. It is used elsewhere in this 
multiversioning code to retrieve what the mangled name would be on the function 
if it did not have the attribute:

https://github.com/llvm/llvm-project/blob/7337db72ed334f8389601f160b762e50c4e61c25/clang/lib/CodeGen/CodeGenModule.cpp#L1857-L1861



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

Reply via email to