[llvm] [NFC] Eliminate use of `lookupLLVMIntrinsicByName` in Coroutines (PR #114851)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 4 10:57:05 PST 2024
https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/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.
>From ec725fd242e0218802bf6c248c4a1391be1ccfe6 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Mon, 4 Nov 2024 10:53:12 -0800
Subject: [PATCH] [NFC] Eliminate use of `lookupLLVMIntrinsicByName` in
Coroutines
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.
---
llvm/lib/Transforms/Coroutines/Coroutines.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
index 45b9767657c66a..331a9c942ae600 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