[llvm] [SimplifyCFG] Use hash map to continue hoisting the common instructions (PR #78615)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 9 04:10:56 PST 2024
================
@@ -1608,16 +1618,39 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(BasicBlock *BB,
auto *TI = BB->getTerminator();
+ SmallVector<BasicBlock *, 8> SuccessorBBs;
+ for (auto *Succ : successors(BB)) {
+ BasicBlock::iterator SuccItr = Succ->begin();
+ // If we find an unreachable instruction at the beginning of a basic block,
+ // we can still hoist instructions from the rest of the basic blocks.
+ if (isa<UnreachableInst>(*SuccItr))
----------------
dtcxzyw wrote:
```suggestion
if (isa<UnreachableInst>(Succ->getFirstNonPHIOrDbg()))
```
https://github.com/llvm/llvm-project/pull/78615
More information about the llvm-commits
mailing list