[llvm] [InferAddressSpaces] Handle unconverted ptrmask (PR #140802)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 01:07:55 PDT 2025


================
@@ -1338,7 +1338,20 @@ bool InferAddressSpacesImpl::rewriteWithNewAddressSpaces(
 
     unsigned OperandNo = PoisonUse->getOperandNo();
     assert(isa<PoisonValue>(NewV->getOperand(OperandNo)));
-    NewV->setOperand(OperandNo, ValueWithNewAddrSpace.lookup(PoisonUse->get()));
+    WeakTrackingVH NewOp = ValueWithNewAddrSpace.lookup(PoisonUse->get());
+    if (NewOp) {
+      NewV->setOperand(OperandNo, NewOp);
+    } else {
+      // Something went wrong while converting the instruction defining the new
+      // operand value.  -> Replace the poison value with the previous operand
+      // value combined with an addrspace case.
----------------
arsenm wrote:

By "Something went wrong" do you just mean rewriteIntrinsicWithAddressSpace returned null? Should we just make that never-fail and required to manage insertion of the cast itself? 

https://github.com/llvm/llvm-project/pull/140802


More information about the llvm-commits mailing list