[llvm] [InstCombine] Push freeze through non-recurrence PHIs (PR #157678)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 23 07:37:56 PDT 2025
================
@@ -5042,10 +5042,33 @@ InstCombinerImpl::pushFreezeToPreventPoisonFromPropagating(FreezeInst &OrigFI) {
// Op1.fr = Freeze(Op1)
// ... = Inst(Op1.fr, NonPoisonOps...)
- auto CanPushFreeze = [](Value *V) {
- if (!isa<Instruction>(V) || isa<PHINode>(V))
+ auto CanPushFreeze = [this](Value *V) {
+ if (!isa<Instruction>(V))
return false;
+ if (auto *PN = dyn_cast<PHINode>(V)) {
+ BasicBlock *BB = PN->getParent();
+ SmallPtrSet<BasicBlock *, 8> VisitedBBs;
+ for (Use &U : PN->incoming_values()) {
----------------
nikic wrote:
FWIW, getIncomingBlock() on a Use is free, the problematic one is getIncomingValueForBlock().
https://github.com/llvm/llvm-project/pull/157678
More information about the llvm-commits
mailing list