llvm-project
632660d4 - [BlockExtractor] Invalidate analyses after splitting landing pads (#217853)

Commit
2 days ago
[BlockExtractor] Invalidate analyses after splitting landing pads (#217853) `-passes=extract-blocks` with no block list still edits the CFG. `splitLandingPadPreds` runs over every function before the block list is consulted and splits any landing pad whose predecessors include a landing pad other than the invoking block, but it never touched `runOnModule`'s `Changed` flag, so the pass returned `PreservedAnalyses::all()` and the DominatorTree cached by an earlier function pass survived a CFG it no longer describes. Two consumers fall over on the reporter's input. ``` opt -passes='function(sroa),extract-blocks,function(instcombine)' test.ll -S ``` gives `br i1 poison` on a condition that is `icmp eq i32 0, 0`, because `prepareWorklist` asks the stale tree about blocks it has no node for. And ``` opt -passes='function(sroa),extract-blocks,function(jump-threading)' test.ll -disable-output ``` trips `assert(TN)` in `SemiNCAInfo::DeleteUnreachable`. Splicing `function(invalidate<domtree>)` in after `extract-blocks` makes both go away. Make the split report itself; the existing ternary in `BlockExtractorPass::run` picks `none()` from there. A module the split does not touch still reports `all()`. The test pins the contract rather than either symptom: `require<domtree>`, the pass, then `verify<domtree>` against the cached tree. On an unpatched tree it aborts with the two blocks the split created missing from the cached tree. Fixes https://github.com/llvm/llvm-project/issues/213833
Author
Parents
Loading