[clang] [RISCV] Overwrite cpu target features for full arch string in target attribute (PR #77426)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 11 12:56:58 PST 2024


================
@@ -281,10 +248,27 @@ bool RISCVTargetInfo::initFeatureMap(
     Features["32bit"] = true;
   }
 
-  std::vector<std::string> NewFeaturesVec =
-      resolveTargetAttrOverride(FeaturesVec, XLen);
+  // If a target attribute specified a full arch string, override all the ISA
+  // extension target features.
+  const auto I = llvm::find(FeaturesVec, "__RISCV_TargetAttrNeedOverride");
+  if (I != FeaturesVec.end()) {
+    std::vector OverrideFeatures = std::vector(std::next(I), FeaturesVec.end());
----------------
topperc wrote:

I'm not sure you can commit the template argument to std::vector.  There was a previous issue with that in this code fixed by 076ec9f5f5bf03983f43f703e3f9d4600bad9653

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


More information about the cfe-commits mailing list