Merge pull request #35591 from meg-gupta/fixdcebug

Use erasePhiArgument instead of eraseArgument in DCE
This commit is contained in:
Meghana Gupta
2021-01-25 19:39:39 -08:00
committed by GitHub

View File

@@ -551,13 +551,12 @@ bool DCE::removeDead(SILFunction &F) {
// This is not necessary in non-OSSA, and will infact be incorrect.
// Because, passing a value as a phi argument does not imply end of
// lifetime in non-OSSA.
BB.eraseArgument(i);
for (auto *pred : BB.getPredecessorBlocks()) {
auto *predTerm = pred->getTerminator();
auto predArg = predTerm->getAllOperands()[i].get();
endLifetimeOfLiveValue(predArg, predTerm);
deleteEdgeValue(pred->getTerminator(), &BB, i);
}
erasePhiArgument(&BB, i);
Changed = true;
BranchesChanged = true;
}