[llvm] [InstCombine] Push freeze through non-recurrence PHIs (PR #157678)
Cullen Rhodes via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 10 02:28:39 PDT 2025
================
@@ -5042,10 +5042,18 @@ 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)) {
+ if (llvm::any_of(PN->incoming_values(), [this, &PN](Use &U) {
+ return DT.dominates(PN->getParent(), PN->getIncomingBlock(U)) ||
----------------
c-rhodes wrote:
added a check for `isBackEdge()`. Although unlike the other edge cases you pointed out I couldn't write a test case that triggered an issue for this one.
https://github.com/llvm/llvm-project/pull/157678
More information about the llvm-commits
mailing list