[llvm] [InferAddressSpaces] Safely delete duplicate dead instructions (PR #222115)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 12:47:35 PDT 2026
================
@@ -1661,8 +1661,12 @@ bool InferAddressSpacesImpl::rewriteWithNewAddressSpaces(
}
}
- for (Instruction *I : DeadInstructions)
- RecursivelyDeleteTriviallyDeadInstructions(I);
+ // Deleting one instruction may recursively delete another queued
+ // instruction. Create handles before the first deletion so overlapping
+ // entries are nulled instead of leaving dangling pointers.
+ SmallVector<WeakTrackingVH> DeadInstructionHandles(DeadInstructions.begin(),
----------------
AlexMaclean wrote:
Should we just change the type of `DeadInstructions`?
https://github.com/llvm/llvm-project/pull/222115
More information about the llvm-commits
mailing list