[clang] [llvm] [RISCV][FMV] Support target_version (PR #99040)

Piyou Chen via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 19:28:21 PDT 2024


================
@@ -3127,6 +3142,32 @@ bool Sema::checkTargetClonesAttrString(
                                  /*IncludeLocallyStreaming=*/false))
         return Diag(LiteralLoc,
                     diag::err_sme_streaming_cannot_be_multiversioned);
+    } else if (TInfo.getTriple().isRISCV()) {
+      // Suppress warn_target_clone_mixed_values
+      HasCommas = false;
+
+      // Only support arch=+ext,... syntax.
+      if (Str.starts_with("arch=+")) {
+        // parseTargetAttr will parse full version string,
+        // the following split Cur string is no longer interesting.
----------------
BeMg wrote:

For example: version string is `arch=+v,+m,+zbb`

After split Cur string will be {"arch=+v", "+m", "+zbb"}, but parseTargetAttr accept the `arch=+v,+m,+zbb` as input.

So here it only want to invoke parseTargetAttr once and early quit when second time.



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


More information about the cfe-commits mailing list