diff options
author | Nikita Popov <npopov@redhat.com> | 2022-07-18 12:08:00 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-07-19 14:28:22 +0200 |
commit | 08860f525a2363ccd697ebb3ff59769e37b1be21 (patch) | |
tree | a81f9164078b11252b68006290d361e0d39be179 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 4539b44148918c332ff966a2a955aca0ab93dde4 (diff) | |
download | llvm-08860f525a2363ccd697ebb3ff59769e37b1be21.zip llvm-08860f525a2363ccd697ebb3ff59769e37b1be21.tar.gz llvm-08860f525a2363ccd697ebb3ff59769e37b1be21.tar.bz2 |
[Local] Allow creating callbr with duplicate successors
Since D129288, callbr is allowed to have duplicate successors. This
patch removes a limitation which prevents optimizations from actually
producing such callbrs.
Differential Revision: https://reviews.llvm.org/D129997
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index b203259..fbae547 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1089,18 +1089,6 @@ bool llvm::TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB, } } - // We cannot fold the block if it's a branch to an already present callbr - // successor because that creates duplicate successors. - for (BasicBlock *PredBB : predecessors(BB)) { - if (auto *CBI = dyn_cast<CallBrInst>(PredBB->getTerminator())) { - if (Succ == CBI->getDefaultDest()) - return false; - for (unsigned i = 0, e = CBI->getNumIndirectDests(); i != e; ++i) - if (Succ == CBI->getIndirectDest(i)) - return false; - } - } - LLVM_DEBUG(dbgs() << "Killing Trivial BB: \n" << *BB); SmallVector<DominatorTree::UpdateType, 32> Updates; |