llvm-project
e901b029 - [BasicBlockUtils] Fixed LoopInfo update in UpdateAnalysisInformation() (#177147)

Commit
6 days ago
[BasicBlockUtils] Fixed LoopInfo update in UpdateAnalysisInformation() (#177147) SplitLandingPadPredecessors() results in an irreducible loop and makes LoopInfo invalid. Verification results in a crash: Assertion `CB != OutsideLoopPreds[i] && "Loop has multiple entry points!"' failed. Created a new test with a broken LoopInfo after SplitLandingPadPredecessors(). The test @split-lp-predecessors-test() after SplitBlockPredecessors(catch_dest, { loop }, "", DT, LI) changes to the following IR where the loop {%catch_dest} gets into irreducible loop {%catch_dest.split-lp, %catch_dest}: ``` define void @split-lp-predecessors-test() personality ptr null { entry: invoke void @foo() to label %loop unwind label %catch_dest.split-lp loop: ; preds = %latch, %entry invoke void @foo() to label %latch unwind label %catch_dest1 latch: ; preds = %loop br label %loop catch_dest1: ; preds = %loop %lpad = landingpad i32 cleanup br label %catch_dest catch_dest.split-lp: ; preds = %entry, %catch_dest %lpad.split-lp = landingpad i32 cleanup br label %catch_dest catch_dest: ; preds = %catch_dest.split-lp, %catch_dest1 invoke void @foo() to label %exit unwind label %catch_dest.split-lp exit: ; preds = %catch_dest ret void } ``` Irreducible loops must be removed from LoopInfo. When UpdateAnalysisInformation() detects an irreducible loop created then the loop is erased from LoopInfo. See the issue #163922 for details.
Author
Parents
Loading