aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2021-01-12 21:49:56 +0300
committerRoman Lebedev <lebedev.ri@gmail.com>2021-01-15 23:35:56 +0300
commitc6654a4cdab4156bae51970fa64993e790fc4adb (patch)
tree6fbe5626984244467758421124531a8f0f6f961f /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parent286cf6cb029a9942df6ff1d99570e93c25fe29f0 (diff)
downloadllvm-c6654a4cdab4156bae51970fa64993e790fc4adb.zip
llvm-c6654a4cdab4156bae51970fa64993e790fc4adb.tar.gz
llvm-c6654a4cdab4156bae51970fa64993e790fc4adb.tar.bz2
[SimplifyCFG][BasicBlockUtils] Port SplitBlockPredecessors()/SplitLandingPadPredecessors() to DomTreeUpdater
This is not nice, but it's the best transient solution possible, and is better than just duplicating the whole function. The problem is, this function is widely used, and it is not at all obvious that all the users could be painlessly switched to operate on DomTreeUpdater, and somehow i don't feel like porting all those users first. This function is one of last three that not operate on DomTreeUpdater.
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index a534643..4c0427e 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1113,7 +1113,7 @@ bool SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(Instruction *TI,
if (!SafeToMergeTerminators(TI, PTI, &FailBlocks)) {
for (auto *Succ : FailBlocks) {
if (!SplitBlockPredecessors(Succ, TI->getParent(), ".fold.split",
- DTU ? &DTU->getDomTree() : nullptr))
+ DTU))
return false;
}
}
@@ -1977,8 +1977,7 @@ static bool SinkCommonCodeFromPredecessors(BasicBlock *BB,
LLVM_DEBUG(dbgs() << "SINK: Splitting edge\n");
// We have a conditional edge and we're going to sink some instructions.
// Insert a new block postdominating all blocks we're going to sink from.
- if (!SplitBlockPredecessors(BB, UnconditionalPreds, ".sink.split",
- DTU ? &DTU->getDomTree() : nullptr))
+ if (!SplitBlockPredecessors(BB, UnconditionalPreds, ".sink.split", DTU))
// Edges couldn't be split.
return false;
Changed = true;
@@ -3391,8 +3390,7 @@ static bool mergeConditionalStoreToAddress(
// branch to QFB and PostBB.
BasicBlock *TruePred = QTB ? QTB : QFB->getSinglePredecessor();
BasicBlock *NewBB =
- SplitBlockPredecessors(PostBB, {QFB, TruePred}, "condstore.split",
- DTU ? &DTU->getDomTree() : nullptr);
+ SplitBlockPredecessors(PostBB, {QFB, TruePred}, "condstore.split", DTU);
if (!NewBB)
return false;
PostBB = NewBB;
@@ -4827,9 +4825,8 @@ static void createUnreachableSwitchDefault(SwitchInst *Switch,
DomTreeUpdater *DTU) {
LLVM_DEBUG(dbgs() << "SimplifyCFG: switch default is dead.\n");
auto *BB = Switch->getParent();
- BasicBlock *NewDefaultBlock =
- SplitBlockPredecessors(Switch->getDefaultDest(), Switch->getParent(), "",
- DTU ? &DTU->getDomTree() : nullptr);
+ BasicBlock *NewDefaultBlock = SplitBlockPredecessors(
+ Switch->getDefaultDest(), Switch->getParent(), "", DTU);
auto *OrigDefaultBlock = Switch->getDefaultDest();
Switch->setDefaultDest(&*NewDefaultBlock);
if (DTU)