diff options
author | Nikita Popov <npopov@redhat.com> | 2022-07-06 16:15:34 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-07-07 09:13:25 +0200 |
commit | 40a4078e14c2c6c5e2d0a1776285aa7491e791b3 (patch) | |
tree | 6475eecc2b5a6888745b587db355700f7f744c13 /llvm/lib/Transforms/Utils/LoopUtils.cpp | |
parent | 66e15d4c01a9ac6898154d146e9b21b9ab843784 (diff) | |
download | llvm-40a4078e14c2c6c5e2d0a1776285aa7491e791b3.zip llvm-40a4078e14c2c6c5e2d0a1776285aa7491e791b3.tar.gz llvm-40a4078e14c2c6c5e2d0a1776285aa7491e791b3.tar.bz2 |
[BasicBlockUtils] Allow splitting predecessors with callbr terminators
SplitBlockPredecessors currently asserts if one of the predecessor
terminators is a callbr. This limitation was originally necessary,
because just like with indirectbr, it was not possible to replace
successors of a callbr. However, this is no longer the case since
D67252. As the requirement nowadays is that callbr must reference
all blockaddrs directly in the call arguments, and these get
automatically updated when setSuccessor() is called, we no longer
need this limitation.
The only thing we need to do here is use replaceSuccessorWith()
instead of replaceUsesOfWith(), because only the former does the
necessary blockaddr updating magic.
I believe there's other similar limitations that can be removed,
e.g. related to critical edge splitting.
Differential Revision: https://reviews.llvm.org/D129205
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index e088cf8..afc7c61 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -75,9 +75,6 @@ bool llvm::formDedicatedExitBlocks(Loop *L, DominatorTree *DT, LoopInfo *LI, if (isa<IndirectBrInst>(PredBB->getTerminator())) // We cannot rewrite exiting edges from an indirectbr. return false; - if (isa<CallBrInst>(PredBB->getTerminator())) - // We cannot rewrite exiting edges from a callbr. - return false; InLoopPredecessors.push_back(PredBB); } else { |