[llvm] [SVE] Don't require lookup when demangling vector function mappings (PR #72260)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 10:39:23 PST 2023


================
@@ -374,6 +414,24 @@ std::optional<VFInfo> VFABI::tryDemangleForVFABI(StringRef MangledName,
   if (Parameters.empty())
     return std::nullopt;
 
+  // Figure out the number of lanes in vectors for this function variant. This
+  // is easy for fixed length, as the vlen encoding just gives us the value
+  // directly. However, if the vlen mangling indicated that this function
+  // variant expects scalable vectors, then we need to figure out the minimum
+  // based on the widest scalar types in vector arguments.
+  std::optional<ElementCount> EC;
+  if (ParsedVF) {
+    // Fixed length VF
+    EC = ElementCount::getFixed(*ParsedVF);
+  } else {
+    // Scalable VF, need to work out the minimum from the element types
+    // in the scalar function arguments.
+    EC = getScalableECFromSignature(CI.getFunctionType(), ISA, Parameters);
----------------
paulwalker-arm wrote:

Extending from my comment above, can this be something like `finaliseElementCountFromSignature` with the current EC passed in.  This means the result can be like `tryParseVLEN` and just return a parse failure when the ElementCount cannot be finalised.

Up to you but part of me prefers this to be the universal path with a quick return for fixed length vectors so the complexity is hidden from here.

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


More information about the llvm-commits mailing list