[llvm] [NFC][Coroutines] Remove redundant checks for replacing PrepareFns (PR #98392)
Yuxuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 14:31:15 PDT 2024
https://github.com/yuxuanchen1997 created https://github.com/llvm/llvm-project/pull/98392
If `Coroutines.empty()` the following loop is going to be skipped entirely and same goes for `PrepareFns.empty()`. These two conditions here aren't useful and adds to complexity.
>From e05a76da5f0cfcf80099eec3b64a3fe38c9b5613 Mon Sep 17 00:00:00 2001
From: Yuxuan Chen <ych at meta.com>
Date: Wed, 10 Jul 2024 14:29:34 -0700
Subject: [PATCH] [NFC][Coroutines] Remove redundant checks for replacing
PrepareFns
---
llvm/lib/Transforms/Coroutines/CoroSplit.cpp | 8 --------
1 file changed, 8 deletions(-)
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 299b514d34f1c..0b52d1e4490cb 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -2108,12 +2108,6 @@ PreservedAnalyses CoroSplitPass::run(LazyCallGraph::SCC &C,
if (Coroutines.empty() && PrepareFns.empty())
return PreservedAnalyses::all();
- if (Coroutines.empty()) {
- for (auto *PrepareFn : PrepareFns) {
- replaceAllPrepares(PrepareFn, CG, C);
- }
- }
-
// Split all the coroutines.
for (LazyCallGraph::Node *N : Coroutines) {
Function &F = N->getFunction();
@@ -2143,11 +2137,9 @@ PreservedAnalyses CoroSplitPass::run(LazyCallGraph::SCC &C,
}
}
- if (!PrepareFns.empty()) {
for (auto *PrepareFn : PrepareFns) {
replaceAllPrepares(PrepareFn, CG, C);
}
- }
return PreservedAnalyses::none();
}
More information about the llvm-commits
mailing list