1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[Coroutines] Simplify implementation using removePredecessor

Differential Revision: https://reviews.llvm.org/D77035
This commit is contained in:
Jun Ma 2020-04-03 09:20:07 +08:00
parent 7db103f3ff
commit c5c5d9a37e

View File

@ -941,11 +941,7 @@ static bool simplifyTerminatorLeadingToRet(Instruction *InitialInst) {
// If InitialInst is an unconditional branch, // If InitialInst is an unconditional branch,
// remove PHI values that come from basic block of InitialInst // remove PHI values that come from basic block of InitialInst
if (UnconditionalSucc) if (UnconditionalSucc)
for (PHINode &PN : UnconditionalSucc->phis()) { UnconditionalSucc->removePredecessor(InitialInst->getParent(), true);
int idx = PN.getBasicBlockIndex(InitialInst->getParent());
if (idx != -1)
PN.removeIncomingValue(idx);
}
ReplaceInstWithInst(InitialInst, I->clone()); ReplaceInstWithInst(InitialInst, I->clone());
} }
return true; return true;