[clang] [AArch64] Implement reinterpret builtins for SVE vector tuples (PR #69598)

Momchil Velikov via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 26 11:38:51 PDT 2023


================
@@ -954,13 +967,13 @@ std::string Intrinsic::replaceTemplatedArgs(std::string Name, TypeSpec TS,
     default:
       llvm_unreachable("Unknown predication specifier");
     case 'd':
-      T = SVEType(TS, 'd');
+      T = SVEType(TS, 'd', 1);
----------------
momchil-velikov wrote:

I don't understand you point here. Using a `StringRef` in the constructor parameter is vastly more efficient then using a `std::string`.

The constructor used to look like

```
class SVEType {
  TypeSpec TS;
  ...

  SVEType(TypeSpec TS, char CharMod, unsigned NumVectors = 1)
      : TS(TS), 
...
```

so you create one copy of the sting to initialize the parameter, one copy to initialize the member variable, and then you call the destructor for the parameter.

Initialisation of `StringRef` does not involve memory allocation or copying the string content,  the type is simple enough that you can expect it to be passed in a pair of registers, and the destructor is trivial, i.e. empty.


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


More information about the cfe-commits mailing list