CodeExtractor looks up the dominator node corresponding to return blocks when splitting them. If one of these blocks is unreachable, there's no node in the Dom and CodeExtractor crashes because it doesn't check for domtree node validity.
In theory, we could add just a check for skipping DTNode == nullptr in splitReturnBlock but the fix I propose here is slightly different. To the best of my knowledge, unreachable blocks are irrelevant for the algorithm, therefore we can just skip them when building the candidate set in the constructor.
I'm not 100% sure if any pass using CodeExtractor could make use of extracting an unreachable block (including bugpoint), in which case my fix would need to be adjusted.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
The root cause of the problem is that the partial inliner split the newreturn block unconditionally -- even when there is no PHIs in them (creating unreachable block). I have included that fix in my patch, but this patch is fine too.
lgtm