[llvm] Fix the logic in DWARFContext thread safety selection (#11) (PR #66786)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 09:01:52 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-debuginfo

<details>
<summary>Changes</summary>

The patch triggered some TSAN reports. Looks like the logic which decided if the thread safe or thread unsafe implementation should be used is inverted. The test is passing with this patch in place.

---
Full diff: https://github.com/llvm/llvm-project/pull/66786.diff


1 Files Affected:

- (modified) llvm/lib/DebugInfo/DWARF/DWARFContext.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index a45ed0e56553d4e..e338a2ebfc9c2c7 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -734,7 +734,7 @@ DWARFContext::DWARFContext(std::unique_ptr<const DWARFObject> DObj,
     : DIContext(CK_DWARF),
       RecoverableErrorHandler(RecoverableErrorHandler),
       WarningHandler(WarningHandler), DObj(std::move(DObj)) {
-        if (ThreadSafe)
+        if (!ThreadSafe)
           State.reset(new ThreadUnsafeDWARFContextState(*this, DWPName));
         else
           State.reset(new ThreadSafeState(*this, DWPName));

``````````

</details>


https://github.com/llvm/llvm-project/pull/66786


More information about the llvm-commits mailing list