[clang] [RISCV][clang] Optimize memory usage of intrinsic lookup table (PR #77487)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 25 11:48:52 PST 2024


================
@@ -464,7 +466,8 @@ void RISCVIntrinsicManagerImpl::CreateRVVIntrinsicDecl(LookupResult &LR,
 bool RISCVIntrinsicManagerImpl::CreateIntrinsicIfFound(LookupResult &LR,
                                                        IdentifierInfo *II,
                                                        Preprocessor &PP) {
-  StringRef Name = II->getName().substr(8);
+  StringRef Name = II->getName();
+  Name.consume_front("__riscv_");
----------------
topperc wrote:

I think we should return false if consume_front returns false. If the string didn't start with __riscv we can't proceed as if it did.

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


More information about the cfe-commits mailing list