[llvm] Switch the intrinsic names to a string table (PR #118929)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 7 12:04:05 PST 2024


================
@@ -638,37 +638,53 @@ int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef<const char *> NameTable,
   if (!Target.empty())
     CmpEnd += 1 + Target.size(); // skip the .target component.
 
-  const char *const *Low = NameTable.begin();
-  const char *const *High = NameTable.end();
-  const char *const *LastLow = Low;
+  const int *Low = NameOffsetTable.begin();
+  const int *High = NameOffsetTable.end();
+  const int *LastLow = Low;
   while (CmpEnd < Name.size() && High - Low > 0) {
     size_t CmpStart = CmpEnd;
     CmpEnd = Name.find('.', CmpStart + 1);
     CmpEnd = CmpEnd == StringRef::npos ? Name.size() : CmpEnd;
-    auto Cmp = [CmpStart, CmpEnd](const char *LHS, const char *RHS) {
-      return strncmp(LHS + CmpStart, RHS + CmpStart, CmpEnd - CmpStart) < 0;
+    auto Cmp = [CmpStart, CmpEnd](auto LHS, auto RHS) {
----------------
jurahul wrote:

Can this be just int now? I assume the comparator is now used with const char * types directly anymore.

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


More information about the llvm-commits mailing list