Skip to content

Commit 8cfa963

Browse files
committed
[SimplifyCFG] If provided, preserve Dominator Tree
SimplifyCFG is an utility pass, and the fact that it does not preserve DomTree's, forces it's users to somehow workaround that, likely by not preserving DomTrees's themselves. Indeed, simplifycfg pass didn't know how to preserve dominator tree, it took me just under a month (starting with e113317) do rectify that, now it fully knows how to, there's likely some problems with that still, but i've dealt with everything i can spot so far. I think we now can flip the switch. Note that this is functionally an NFC change, since this doesn't change the users to pass in the DomTree, that is a separate question. Reviewed By: kuhar, nikic Differential Revision: https://reviews.llvm.org/D94827
1 parent d0c9fb1 commit 8cfa963

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6561,20 +6561,10 @@ bool SimplifyCFGOpt::simplifyOnceImpl(BasicBlock *BB) {
65616561
bool SimplifyCFGOpt::simplifyOnce(BasicBlock *BB) {
65626562
bool Changed = simplifyOnceImpl(BB);
65636563

6564-
assert((!RequireAndPreserveDomTree ||
6565-
(DTU &&
6566-
DTU->getDomTree().verify(DominatorTree::VerificationLevel::Full))) &&
6567-
"Failed to maintain validity of domtree!");
6568-
65696564
return Changed;
65706565
}
65716566

65726567
bool SimplifyCFGOpt::run(BasicBlock *BB) {
6573-
assert((!RequireAndPreserveDomTree ||
6574-
(DTU &&
6575-
DTU->getDomTree().verify(DominatorTree::VerificationLevel::Full))) &&
6576-
"Original domtree is invalid?");
6577-
65786568
bool Changed = false;
65796569

65806570
// Repeated simplify BB as long as resimplification is requested.
@@ -6592,7 +6582,7 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) {
65926582
bool llvm::simplifyCFG(BasicBlock *BB, const TargetTransformInfo &TTI,
65936583
DomTreeUpdater *DTU, const SimplifyCFGOptions &Options,
65946584
ArrayRef<WeakVH> LoopHeaders) {
6595-
return SimplifyCFGOpt(TTI, RequireAndPreserveDomTree ? DTU : nullptr,
6596-
BB->getModule()->getDataLayout(), LoopHeaders, Options)
6585+
return SimplifyCFGOpt(TTI, DTU, BB->getModule()->getDataLayout(), LoopHeaders,
6586+
Options)
65976587
.run(BB);
65986588
}

0 commit comments

Comments
 (0)