[clang] [llvm] [SimplifyCFG] Extend jump-threading to allow live local defs (PR #135079)
via cfe-commits
cfe-commits at lists.llvm.org
Wed May 28 14:10:13 PDT 2025
================
@@ -3467,13 +3485,23 @@ static bool blockIsSimpleEnoughToThreadThrough(BasicBlock *BB) {
// live outside of the current basic block.
for (User *U : I.users()) {
Instruction *UI = cast<Instruction>(U);
- if (UI->getParent() != BB || isa<PHINode>(UI))
- return false;
+ BasicBlock *UsedInBB = UI->getParent();
+ if (UsedInBB == BB) {
+ if (isa<PHINode>(UI))
+ return false;
+ } else
+ UsedInNonLocalBlocksSet.insert(UsedInBB);
}
// Looks ok, continue checking.
}
+ for (BasicBlock *Succ : successors(BB)) {
+ BlocksSet VisitedBlocksSet;
+ if (reachesUsed(Succ, UsedInNonLocalBlocksSet, VisitedBlocksSet))
----------------
LU-JOHN wrote:
Do reachesUsed after check checks.
https://github.com/llvm/llvm-project/pull/135079
More information about the cfe-commits
mailing list