[PATCH] D46438: AMDGPU: Use eraseFromParent to delete am instruction when it is no longer needed.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 8 11:36:12 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL331788: AMDGPU: Use eraseFromParent to delete am instruction when it is no longer… (authored by chfang, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D46438?vs=145211&id=145743#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D46438

Files:
  llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp


Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
@@ -145,7 +145,8 @@
     if (PN)
       PN->addIncoming(BB->getTerminator()->getOperand(0), BB);
 
-    BB->getInstList().pop_back();  // Remove the return insn
+    // Remove and delete the return inst.
+    BB->getTerminator()->eraseFromParent();
     BranchInst::Create(NewRetBlock, BB);
   }
 
@@ -190,7 +191,8 @@
       new UnreachableInst(F.getContext(), UnreachableBlock);
 
       for (BasicBlock *BB : UnreachableBlocks) {
-        BB->getInstList().pop_back();  // Remove the unreachable inst.
+        // Remove and delete the unreachable inst.
+        BB->getTerminator()->eraseFromParent();
         BranchInst::Create(UnreachableBlock, BB);
       }
     }
@@ -201,7 +203,8 @@
 
       Type *RetTy = F.getReturnType();
       Value *RetVal = RetTy->isVoidTy() ? nullptr : UndefValue::get(RetTy);
-      UnreachableBlock->getInstList().pop_back();  // Remove the unreachable inst.
+      // Remove and delete the unreachable inst.
+      UnreachableBlock->getTerminator()->eraseFromParent();
 
       Function *UnreachableIntrin =
         Intrinsic::getDeclaration(F.getParent(), Intrinsic::amdgcn_unreachable);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46438.145743.patch
Type: text/x-patch
Size: 1399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180508/7f9a1402/attachment.bin>


More information about the llvm-commits mailing list