[llvm] [InferAddressSpaces] Fix null PHI operand when an incoming flat expression is not rewritten (PR #205749)
Robert Imschweiler via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 25 03:01:55 PDT 2026
================
@@ -1550,10 +1550,33 @@ bool InferAddressSpacesImpl::rewriteWithNewAddressSpaces(
unsigned OperandNo = PoisonUse->getOperandNo();
assert(isa<PoisonValue>(NewV->getOperand(OperandNo)));
- WeakTrackingVH NewOp = ValueWithNewAddrSpace.lookup(PoisonUse->get());
- assert(NewOp &&
- "poison replacements in ValueWithNewAddrSpace shouldn't be null");
- NewV->setOperand(OperandNo, NewOp);
+ Value *NewOperand = ValueWithNewAddrSpace.lookup(PoisonUse->get());
+ if (!NewOperand) {
----------------
ro-i wrote:
I think you should compare your logic in the "if" with what `operandWithNewAddressSpaceOrCreatePoison` does.
Btw, that function might seems to be the only place where stuff is added to PoisonUsesToFix. But, `Constant` seems to be never added (1), which makes your handling of `Constant` here probably unnecessary?
(1)
https://github.com/llvm/llvm-project/blob/7083c06372905081929ea43abea4751ef372761a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp#L782-L783
https://github.com/llvm/llvm-project/pull/205749
More information about the llvm-commits
mailing list