There might be a misuse of DominatorTree::splitBasicBlock in CodeExtractor.cpp, line 145.
Header is splited into two (OldPred->NewBB).
Line 145 updates the dominator tree by calling DT->splitBasicBlock(NewBB).
I think it should be DT->splitBasicBlock(OldPred).
When I tried to extract a code region whose header has 2 successors, my pass crashed.
It was because header (or OldPred) is the block that was splited, not NewBB.
DominatorTree::splitBasicBlock(BB) requires BB to have one successor.
The code in Dominator::splitBasicBlock() looks correct, but I think the comment and assert may not be. I was writing a patch where I hit the same issue.
Thank you, Cameron.
I also think Dominator::splitBasicBlock() is kind of OK, except the assertion at line 232 (Dominator.h)
That assertion fails when we split the entry basic block (obviously, it does not have any dominator).
What I asked for was the use of splitBasicBlock in CodeExtractor.cpp, line 145.
Vu