[llvm] [InstCombine] Push freeze through non-recurrence PHIs (PR #157678)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 23 08:00:53 PDT 2025
================
@@ -5070,7 +5093,10 @@ InstCombinerImpl::pushFreezeToPreventPoisonFromPropagating(FreezeInst &OrigFI) {
return nullptr;
auto *UserI = cast<Instruction>(U->getUser());
- Builder.SetInsertPoint(UserI);
+ if (auto *PN = dyn_cast<PHINode>(UserI))
+ Builder.SetInsertPoint(PN->getIncomingBlock(*U)->getTerminator());
----------------
david-arm wrote:
Perhaps I'm missing something, but before your patch CanPushFreeze always returned false for PHI nodes which meant we were calling `Builder.SetInsertPoint(UserI);` for PHI nodes.
However, even in places where we still return false for PHI nodes same as before we're now calling `Builder.SetInsertPoint(PN->getIncomingBlock(*U)->getTerminator());`. For example, it looks like you've changed the insertion point for PHI nodes with `undef` as incoming value since we still return false for those cases the same as before.
https://github.com/llvm/llvm-project/pull/157678
More information about the llvm-commits
mailing list