[llvm] [AMDGPU] Promote allocas used by phi/select (PR #221870)

Yoonseo Choi via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 17:03:49 PDT 2026


================
@@ -1220,15 +1409,18 @@ void AMDGPUPromoteAllocaImpl::promoteAllocaToVector(AllocaAnalysis &AA) {
   }
 
   // Delete all the users that are known to be removeable.
-  for (Instruction *I : reverse(AA.Vector.UsersToRemove)) {
+  // Replace the uses with poison first so they can be deleted in any order.
+  for (Instruction *I : AA.Vector.UsersToRemove) {
     I->dropDroppableUses();
-    assert(I->use_empty());
+    I->replaceAllUsesWith(PoisonValue::get(I->getType()));
----------------
yoonseoch wrote:

A new form of assertion should be added as the previous code had one. 

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


More information about the llvm-commits mailing list