diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp --- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp @@ -1219,14 +1219,13 @@ }; // 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,