[NFCI][Local] TryToSimplifyUncondBranchFromEmptyBlock(): improve Dominator Tree updating
authorRoman Lebedev <lebedev.ri@gmail.com>
Sun, 11 Apr 2021 19:39:22 +0000 (22:39 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sun, 11 Apr 2021 20:56:22 +0000 (23:56 +0300)
commit2def9c3d8ed9df5a5dc737343c891ac17de1afc1
tree29fdc151e4bb56e38e7e30d5fe184e643b809abf
parent6d44b3c56d4a80b16f144a52bc841111c0b4d2c2
[NFCI][Local] TryToSimplifyUncondBranchFromEmptyBlock(): improve Dominator Tree updating

First, we don't need vector-ness for the predecessor lists.

Secondly, like elsewhere, do insertions before deletions.

Lastly, the check that we actually need to insert an edge,
that it doesn't exist already, is backwards. Instead of
looking at successors of every single 'PredOfBB',
just always look at predecessors of the 'Succ'.
The result is always the same, but we avoid *really* inefficient code.
llvm/lib/Transforms/Utils/Local.cpp