[SimplifyCFG] Teach SimplifyCondBranchToTwoReturns() to preserve DomTree, part 2

... for the custom case returning void.
This commit is contained in:
Roman Lebedev 2020-12-19 20:07:26 +03:00
parent b94520c9ee
commit 6a1617d67c
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
2 changed files with 5 additions and 1 deletions

View File

@ -2631,6 +2631,10 @@ bool SimplifyCFGOpt::SimplifyCondBranchToTwoReturns(BranchInst *BI,
FalseSucc->removePredecessor(BB);
Builder.CreateRetVoid();
EraseTerminatorAndDCECond(BI);
if (DTU) {
DTU->applyUpdatesPermissive({{DominatorTree::Delete, BB, TrueSucc},
{DominatorTree::Delete, BB, FalseSucc}});
}
return true;
}

View File

@ -1,6 +1,6 @@
;; Check that we don't crash. PR37300.
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt %s -S -simplifycfg | FileCheck %s
; RUN: opt %s -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | FileCheck %s
define void @patatino() {
; CHECK-LABEL: @patatino(