[llvm] 8888352 - [NFC] Eliminate use of `lookupLLVMIntrinsicByName` in Coroutines (#114851)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 07:20:24 PST 2024


Author: Rahul Joshi
Date: 2024-11-12T07:20:18-08:00
New Revision: 88883528fd324bc641e5ef223631974c5de4c738

URL: https://github.com/llvm/llvm-project/commit/88883528fd324bc641e5ef223631974c5de4c738
DIFF: https://github.com/llvm/llvm-project/commit/88883528fd324bc641e5ef223631974c5de4c738.diff

LOG: [NFC] Eliminate use of `lookupLLVMIntrinsicByName` in Coroutines (#114851)

Eliminate use of `lookupLLVMIntrinsicByName` from Coroutines in
preparation of changing it to support a different form of intrinsic name
table generated by intrinsic emitter.

Also eliminate call to `isCoroutineIntrinsicName` from
`declaresAnyIntrinsic` as the list of names traversed is the same list
which `isCoroutineIntrinsicName` checks.

Added: 
    

Modified: 
    llvm/lib/Transforms/Coroutines/Coroutines.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
index 9032cadcdcae06..240d089ebeff84 100644
--- a/llvm/lib/Transforms/Coroutines/Coroutines.cpp
+++ b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
@@ -100,8 +100,7 @@ static const char *const CoroIntrinsics[] = {
 
 #ifndef NDEBUG
 static bool isCoroutineIntrinsicName(StringRef Name) {
-  return Intrinsic::lookupLLVMIntrinsicByName(CoroIntrinsics, Name, "coro") !=
-         -1;
+  return llvm::binary_search(CoroIntrinsics, Name);
 }
 #endif
 
@@ -111,7 +110,6 @@ bool coro::isSuspendBlock(BasicBlock *BB) {
 
 bool coro::declaresAnyIntrinsic(const Module &M) {
   for (StringRef Name : CoroIntrinsics) {
-    assert(isCoroutineIntrinsicName(Name) && "not a coroutine intrinsic");
     if (M.getNamedValue(Name))
       return true;
   }


        


More information about the llvm-commits mailing list