================
@@ -805,8 +844,32 @@ bool CIRGenModule::getCPUAndFeaturesAttributes(
     attrs["cir.target-features"] = llvm::join(features, ",");
     addedAttr = true;
   }
-  // TODO(cir): add metadata for AArch64 Function Multi Versioning.
-  assert(!cir::MissingFeatures::opFuncMultiVersioning());
+  // Add metadata for AArch64 Function Multi Versioning. An empty string value
+  // for "cir.fmv-features" represents the default version (matches OGCG's
+  // value-less LLVM attribute).
+  if (getTarget().getTriple().isAArch64()) {
+    llvm::SmallVector<llvm::StringRef, 8> feats;
+    bool isDefault = false;
+    if (tv) {
+      isDefault = tv->isDefaultVersion();
+      tv->getFeatures(feats);
+    } else if (tc) {
+      isDefault = tc->isDefaultVersion(gd.getMultiVersionIndex());
+      tc->getFeatures(feats, gd.getMultiVersionIndex());
+    }
+    if (isDefault) {
+      attrs["cir.fmv-features"] = "";
----------------
skc7 wrote:

CC: @andykaylor 

https://github.com/llvm/llvm-project/pull/195813
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to