[llvm] [LLVM][TableGen] Check overloaded intrinsic mangling suffix conflicts (PR #110324)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 09:15:20 PDT 2024


================
@@ -124,6 +125,132 @@ void CodeGenIntrinsicTable::CheckTargetIndependentIntrinsics() const {
   }
 }
 
+// Return true if the given Suffix looks like mangled type. Note that this
+// check is conservative, but allows all existing LLVM intrinsic suffixes to be
+// consider as not looking like a mangling suffix.
+static bool doesSuffixLookLikeMangledType(StringRef Suffix) {
+  // Try to match against possible mangling suffixes for various types.
+  // See getMangledTypeStr() for the mangling suffixes possible. It includes
+  //  pointer       : p[0-9]+
+  //  array         : a[0-9]+[.+]
+  //  struct:       : s_/sl_[.+]
+  //  function      : f_[.+]
+  //  vector        : v/nxv[0-9]+[.+]
+  //  target type   : t[.*]
+  //  integer       : i[0-9]+
+  //  named types   : See `NamedTypes` below.
+
+  // Match anything with an _, so match function and struct types.
+  if (Suffix.contains('_'))
+    return true;
+
+  // [a|v][0-9|$][.*] // $ is end of string.
+  if (is_contained("av", Suffix[0]) &&
+      (Suffix.size() == 1 || isDigit(Suffix[1])))
----------------
nikic wrote:

Is just `.a`/`.v` a valid mangling suffix?

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


More information about the llvm-commits mailing list