mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-20 06:18:55 +00:00
[mlir][OpenMP] Fix memory leak by deleting unused value
Reviewed By: ftynse, rriddle Differential Revision: https://reviews.llvm.org/D122633
This commit is contained in:
parent
ecb4171dcb
commit
4d1010909f
@ -1219,14 +1219,13 @@ convertOmpAtomicCapture(omp::AtomicCaptureOp atomicCaptureOp,
|
||||
};
|
||||
// Handle ambiguous alloca, if any.
|
||||
auto allocaIP = findAllocaInsertPoint(builder, moduleTranslation);
|
||||
llvm::UnreachableInst *unreachableInst;
|
||||
if (allocaIP.getPoint() == ompLoc.IP.getPoint()) {
|
||||
// Same point => split basic block and make them unambigous.
|
||||
unreachableInst = builder.CreateUnreachable();
|
||||
llvm::UnreachableInst *unreachableInst = builder.CreateUnreachable();
|
||||
builder.SetInsertPoint(builder.GetInsertBlock()->splitBasicBlock(
|
||||
unreachableInst, "alloca_split"));
|
||||
ompLoc.IP = builder.saveIP();
|
||||
unreachableInst->removeFromParent();
|
||||
unreachableInst->eraseFromParent();
|
||||
}
|
||||
builder.restoreIP(ompBuilder->createAtomicCapture(
|
||||
ompLoc, findAllocaInsertPoint(builder, moduleTranslation), llvmAtomicX,
|
||||
|
Loading…
Reference in New Issue
Block a user