[llvm] 0483f14 - [NFC][Coroutines] Remove redundant checks for replacing PrepareFns (#98392)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 22:22:49 PDT 2024


Author: Yuxuan Chen
Date: 2024-07-10T22:22:45-07:00
New Revision: 0483f14b003cb3a2c0045d8f54523a2e9a266b0f

URL: https://github.com/llvm/llvm-project/commit/0483f14b003cb3a2c0045d8f54523a2e9a266b0f
DIFF: https://github.com/llvm/llvm-project/commit/0483f14b003cb3a2c0045d8f54523a2e9a266b0f.diff

LOG: [NFC][Coroutines] Remove redundant checks for replacing PrepareFns (#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.

Added: 
    

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

Removed: 
    


################################################################################
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