diff options
author | XChy <xxs_chy@outlook.com> | 2024-04-16 22:52:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-16 22:52:19 +0800 |
commit | d2d4a1bbdc455a30d600743eb59fb1c69205967a (patch) | |
tree | df6dfd5613c4989e80818ce1103bcba5189c64d0 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | b63247627c9e87e898dec5bf0bea255b3f0eec5c (diff) | |
download | llvm-d2d4a1bbdc455a30d600743eb59fb1c69205967a.zip llvm-d2d4a1bbdc455a30d600743eb59fb1c69205967a.tar.gz llvm-d2d4a1bbdc455a30d600743eb59fb1c69205967a.tar.bz2 |
Revert "[JumpThreading] Thread over BB with only an unconditional branch" (#88907)
Reverts llvm/llvm-project#86312
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index baec51a..a42ef0c 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1019,14 +1019,12 @@ CanRedirectPredsOfEmptyBBToSucc(BasicBlock *BB, BasicBlock *Succ, const SmallPtrSetImpl<BasicBlock *> &SuccPreds, BasicBlock *&CommonPred) { - // When Succ has no phis, BB may be merged into Succ directly. We don't need - // to redirect the predecessors of BB in this case. - if (Succ->phis().empty()) + // There must be phis in BB, otherwise BB will be merged into Succ directly + if (BB->phis().empty() || Succ->phis().empty()) return false; - // BB must have multiple different predecessors, so that at least one of - // predecessors can be redirected to Succ, except the common predecessor. - if (BB->getUniquePredecessor() || pred_empty(BB)) + // BB must have predecessors not shared that can be redirected to Succ + if (!BB->hasNPredecessorsOrMore(2)) return false; // Get single common predecessors of both BB and Succ |