[Mlir-commits] [mlir] 4d10109 - [mlir][OpenMP] Fix memory leak by deleting unused value

Shraiysh Vaishay llvmlistbot at llvm.org
Tue Mar 29 14:56:03 PDT 2022


Author: Shraiysh Vaishay
Date: 2022-03-30T03:25:53+05:30
New Revision: 4d1010909f2e18a71a1597c40b64bda84a5f6d1f

URL: https://github.com/llvm/llvm-project/commit/4d1010909f2e18a71a1597c40b64bda84a5f6d1f
DIFF: https://github.com/llvm/llvm-project/commit/4d1010909f2e18a71a1597c40b64bda84a5f6d1f.diff

LOG: [mlir][OpenMP] Fix memory leak by deleting unused value

Reviewed By: ftynse, rriddle

Differential Revision: https://reviews.llvm.org/D122633

Added: 
    

Modified: 
    mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index f50218f0e3410..9b4c8cf990d2e 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -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,


        


More information about the Mlir-commits mailing list