diff options
author | Kazu Hirata <kazu@google.com> | 2024-01-24 22:11:56 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2024-01-24 22:11:56 -0800 |
commit | a13b7df7f2d19f0798dbb6c1c7aeac8c84002338 (patch) | |
tree | cbf91ab96ebd762279572c9b2cb39e6c685d7611 /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 5b2772e1fad3fc8b44400b91de4d5bd0724bba75 (diff) | |
download | llvm-a13b7df7f2d19f0798dbb6c1c7aeac8c84002338.zip llvm-a13b7df7f2d19f0798dbb6c1c7aeac8c84002338.tar.gz llvm-a13b7df7f2d19f0798dbb6c1c7aeac8c84002338.tar.bz2 |
[CodeGen] Use llvm::successors (NFC)
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 8ee1f19..2d18eba 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -972,10 +972,9 @@ bool CodeGenPrepare::isMergingEmptyBlockProfitable(BasicBlock *BB, // that leads to this block. // FIXME: Is this really needed? Is this a correctness issue? for (BasicBlock *Pred : predecessors(BB)) { - if (auto *CBI = dyn_cast<CallBrInst>((Pred)->getTerminator())) - for (unsigned i = 0, e = CBI->getNumSuccessors(); i != e; ++i) - if (DestBB == CBI->getSuccessor(i)) - return false; + if (isa<CallBrInst>(Pred->getTerminator()) && + llvm::is_contained(successors(Pred), DestBB)) + return false; } // Try to skip merging if the unique predecessor of BB is terminated by a |