[clang] [RISCV][clang] Optimize memory usage of intrinsic lookup table (PR #77487)
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 14 23:48:22 PST 2024
================
@@ -416,8 +416,10 @@ class RVVIntrinsic {
RVVTypePtr getOutputType() const { return OutputType; }
const RVVTypes &getInputTypes() const { return InputTypes; }
llvm::StringRef getBuiltinName() const { return BuiltinName; }
- llvm::StringRef getName() const { return Name; }
- llvm::StringRef getOverloadedName() const { return OverloadedName; }
+ llvm::StringRef getName() const { return "__riscv_" + Name; }
----------------
topperc wrote:
`Name` is a std::string. The addition creates a new temporary std::string. That only has a lifetime of the body of the function. The StringRef points to the temporary std::string.
https://github.com/llvm/llvm-project/pull/77487
More information about the cfe-commits
mailing list