[llvm] 9c6f32a - [Coroutines] Simplify implementation using removePredecessor

Jun Ma via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 18:21:32 PDT 2020


Author: Jun Ma
Date: 2020-04-03T09:20:07+08:00
New Revision: 9c6f32a0ffd648f9ac1a976397c999aa1d50e48b

URL: https://github.com/llvm/llvm-project/commit/9c6f32a0ffd648f9ac1a976397c999aa1d50e48b
DIFF: https://github.com/llvm/llvm-project/commit/9c6f32a0ffd648f9ac1a976397c999aa1d50e48b.diff

LOG: [Coroutines] Simplify implementation using removePredecessor

Differential Revision: https://reviews.llvm.org/D77035

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 2133caa27b03..96c888d10d62 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -941,11 +941,7 @@ static bool simplifyTerminatorLeadingToRet(Instruction *InitialInst) {
         // If InitialInst is an unconditional branch,
         // remove PHI values that come from basic block of InitialInst
         if (UnconditionalSucc)
-          for (PHINode &PN : UnconditionalSucc->phis()) {
-            int idx = PN.getBasicBlockIndex(InitialInst->getParent());
-            if (idx != -1)
-              PN.removeIncomingValue(idx);
-          }
+          UnconditionalSucc->removePredecessor(InitialInst->getParent(), true);
         ReplaceInstWithInst(InitialInst, I->clone());
       }
       return true;


        


More information about the llvm-commits mailing list