[llvm] [SimplifyCFG] Hoist common code when succ is unreachable block (PR #165570)
Kunqiu Chen via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 29 08:54:55 PDT 2025
================
@@ -1866,10 +1866,19 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(Instruction *TI,
// If either of the blocks has it's address taken, then we can't do this fold,
// because the code we'd hoist would no longer run when we jump into the block
// by it's address.
- for (auto *Succ : successors(BB))
- if (Succ->hasAddressTaken() || !Succ->getSinglePredecessor())
+ for (auto *Succ : successors(BB)) {
+ if (Succ->hasAddressTaken())
return false;
-
+ if (Succ->getSinglePredecessor())
----------------
Camsyn wrote:
@nikic, what do you think of such a case?
https://github.com/llvm/llvm-project/pull/165570
More information about the llvm-commits
mailing list