mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[NFCI][SimplifyCFG] PerformValueComparisonIntoPredecessorFolding(): improve Dominator Tree updating
Same as with previous patches.
This commit is contained in:
parent
3f8200bd5d
commit
74d4501854
@ -1115,7 +1115,7 @@ bool SimplifyCFGOpt::PerformValueComparisonIntoPredecessorFolding(
|
||||
BasicBlock *BB = TI->getParent();
|
||||
BasicBlock *Pred = PTI->getParent();
|
||||
|
||||
std::vector<DominatorTree::UpdateType> Updates;
|
||||
SmallVector<DominatorTree::UpdateType, 32> Updates;
|
||||
|
||||
// Figure out which 'cases' to copy from SI to PSI.
|
||||
std::vector<ValueEqualityComparisonCase> BBCases;
|
||||
@ -1256,13 +1256,18 @@ bool SimplifyCFGOpt::PerformValueComparisonIntoPredecessorFolding(
|
||||
// Okay, at this point, we know which new successor Pred will get. Make
|
||||
// sure we update the number of entries in the PHI nodes for these
|
||||
// successors.
|
||||
SmallPtrSet<BasicBlock *, 2> SuccsOfPred;
|
||||
if (DTU) {
|
||||
SuccsOfPred = {succ_begin(Pred), succ_end(Pred)};
|
||||
Updates.reserve(Updates.size() + NewSuccessors.size());
|
||||
}
|
||||
for (const std::pair<BasicBlock *, int /*Num*/> &NewSuccessor :
|
||||
NewSuccessors) {
|
||||
for (auto I : seq(0, NewSuccessor.second)) {
|
||||
(void)I;
|
||||
AddPredecessorToBlock(NewSuccessor.first, Pred, BB);
|
||||
}
|
||||
if (DTU && !is_contained(successors(Pred), NewSuccessor.first))
|
||||
if (DTU && !SuccsOfPred.contains(NewSuccessor.first))
|
||||
Updates.push_back({DominatorTree::Insert, Pred, NewSuccessor.first});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user