================
@@ -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"] = "";
----------------
andykaylor wrote:

This was my concern when I saw this patch. It seems we're added a good bit of 
code that can't be tested yet. Typically for CIR, we insert `errorNYI` calls in 
untested branches, even if the diagnostic is just marking the fact that the 
feature needs a test.

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