[llvm] [NFC] Eliminate use of `lookupLLVMIntrinsicByName` in Coroutines (PR #114851)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 5 07:04:46 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Rahul Joshi (jurahul)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/114851.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Coroutines/Coroutines.cpp (+1-3)
``````````diff
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;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/114851
More information about the llvm-commits
mailing list