Author: Jan Svoboda
Date: 2025-03-12T08:51:00-07:00
New Revision: f4d599cda90aa06d1e1a95474a0ee3a4053e77dd

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

LOG: [Support] Do not remove lock file on failure (#130834)

Clients of `LockFileManager` call `unsafeRemoveLockFile()` whenever
`tryLock()` fails. However looking at the code, there are no scenarios
where this actually does something useful. This PR removes such calls.

Added: 
    

Modified: 
    clang/lib/Frontend/CompilerInstance.cpp
    llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/CompilerInstance.cpp 
b/clang/lib/Frontend/CompilerInstance.cpp
index e9e96683ca51f..44f4f48ef94e8 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1491,8 +1491,6 @@ static bool compileModuleAndReadASTBehindLock(
       // related errors.
       Diags.Report(ModuleNameLoc, diag::remark_module_lock_failure)
           << Module->Name << toString(std::move(Err));
-      // Clear out any potential leftover.
-      Lock.unsafeRemoveLockFile();
       return compileModuleAndReadASTImpl(ImportingInstance, ImportLoc,
                                          ModuleNameLoc, Module, 
ModuleFileName);
     }

diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp 
b/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
index 65cbb13628301..e2e449f1c8a38 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
@@ -1552,7 +1552,6 @@ PreservedAnalyses AMDGPUSplitModulePass::run(Module &M,
         LLVM_DEBUG(
             dbgs() << "[amdgpu-split-module] unable to acquire lockfile, debug 
"
                       "output may be mangled by other processes\n");
-        Lock.unsafeRemoveLockFile();
       } else if (!Owned) {
         switch (Lock.waitForUnlock()) {
         case LockFileManager::Res_Success:


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to