================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to