[llvm] [BasicBlockUtils] Fix SplitBlockPredecessors incorrect dominator insert (PR #107190)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 00:19:00 PDT 2024
================
@@ -1160,7 +1160,10 @@ static void UpdateAnalysisInformation(BasicBlock *OldBB, BasicBlock *NewBB,
// Split block expects NewBB to have a non-empty set of predecessors.
SmallVector<DominatorTree::UpdateType, 8> Updates;
SmallPtrSet<BasicBlock *, 8> UniquePreds;
- Updates.push_back({DominatorTree::Insert, NewBB, OldBB});
+ if (OldBB->getSinglePredecessor()) {
+ assert(OldBB->getSinglePredecessor() == NewBB);
+ Updates.push_back({DominatorTree::Insert, NewBB, OldBB});
+ }
----------------
nikic wrote:
I don't really understand this fix. The updates here are just the CFG changes, and as far as I can tell we do indeed always insert a CFG edge from NewBB to OldBB, so it should be reflected in the updates.
https://github.com/llvm/llvm-project/pull/107190
More information about the llvm-commits
mailing list