[llvm] r331788 - AMDGPU: Use eraseFromParent to delete am instruction when it is no longer needed.
Changpeng Fang via llvm-commits
llvm-commits at lists.llvm.org
Tue May 8 11:32:36 PDT 2018
Author: chfang
Date: Tue May 8 11:32:35 2018
New Revision: 331788
URL: http://llvm.org/viewvc/llvm-project?rev=331788&view=rev
Log:
AMDGPU: Use eraseFromParent to delete am instruction when it is no longer needed.
Reviewer: Nicolai
Differential Revision:
https://reviews.llvm.org/D46438
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp?rev=331788&r1=331787&r2=331788&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp Tue May 8 11:32:35 2018
@@ -145,7 +145,8 @@ static BasicBlock *unifyReturnBlockSet(F
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 @@ bool AMDGPUUnifyDivergentExitNodes::runO
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 @@ bool AMDGPUUnifyDivergentExitNodes::runO
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);
More information about the llvm-commits
mailing list