[PATCH] D42406: Utils: Fix DomTree update for entry block
Jakub Kuderski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 11:08:32 PST 2018
kuhar added inline comments.
================
Comment at: lib/Transforms/Utils/BasicBlockUtils.cpp:324
+ if (OldBB == DT->getRootNode()->getBlock()) {
+ assert(NewBB == &NewBB->getParent()->getEntryBlock());
+ DT->setNewRoot(NewBB);
----------------
Can you also add a comment explaining why we need this special case here? I think the reason is that `DT.splitBlock` expects `NewBB` to have a non-empty set of predecessors.
================
Comment at: lib/Transforms/Utils/BasicBlockUtils.cpp:327
+ } else
+ DT->splitBlock(NewBB);
+ }
----------------
Without the patch, was the crash happening inside Split in `GenericDomTree.h`? If it doesn't support it, maybe it would make sense to assert in `DT->split` that `NewBB != getRootNode()` for (forward) dominators?
https://reviews.llvm.org/D42406
More information about the llvm-commits
mailing list