[llvm] [InstCombine] Treat identical operands as one in pushFreezeToPreventPoisonFromPropagating (PR #145348)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 26 13:28:10 PDT 2025
================
@@ -4774,7 +4774,9 @@ InstCombinerImpl::pushFreezeToPreventPoisonFromPropagating(FreezeInst &OrigFI) {
Use *MaybePoisonOperand = nullptr;
for (Use &U : OrigOpInst->operands()) {
if (isa<MetadataAsValue>(U.get()) ||
- isGuaranteedNotToBeUndefOrPoison(U.get()))
+ isGuaranteedNotToBeUndefOrPoison(U.get()) ||
+ // Treat identical operands as a single operand.
+ (MaybePoisonOperand && MaybePoisonOperand->get() == U.get()))
----------------
nikic wrote:
The code below is still only replacing one of the uses. We should be replacing all of them.
You kind of get away with it because we'll later try to freeze other uses in a separate transform, but this needs to be individually correct.
https://github.com/llvm/llvm-project/pull/145348
More information about the llvm-commits
mailing list