[PATCH] D120218: [BOLT][NFC] Fix data race in ShrinkWrapping stats

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 20 17:22:07 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG36ada32727d8: [BOLT][NFC] Fix data race in ShrinkWrapping stats (authored by Amir).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120218/new/

https://reviews.llvm.org/D120218

Files:
  bolt/include/bolt/Passes/ShrinkWrapping.h
  bolt/lib/Passes/ShrinkWrapping.cpp


Index: bolt/lib/Passes/ShrinkWrapping.cpp
===================================================================
--- bolt/lib/Passes/ShrinkWrapping.cpp
+++ bolt/lib/Passes/ShrinkWrapping.cpp
@@ -710,8 +710,8 @@
   IsInitialized = true;
 }
 
-uint64_t ShrinkWrapping::SpillsMovedRegularMode = 0;
-uint64_t ShrinkWrapping::SpillsMovedPushPopMode = 0;
+std::atomic_uint64_t ShrinkWrapping::SpillsMovedRegularMode{0};
+std::atomic_uint64_t ShrinkWrapping::SpillsMovedPushPopMode{0};
 
 using BBIterTy = BinaryBasicBlock::iterator;
 
Index: bolt/include/bolt/Passes/ShrinkWrapping.h
===================================================================
--- bolt/include/bolt/Passes/ShrinkWrapping.h
+++ bolt/include/bolt/Passes/ShrinkWrapping.h
@@ -308,8 +308,8 @@
   std::vector<MCInst *> BestSavePos;
 
   /// Pass stats
-  static uint64_t SpillsMovedRegularMode;
-  static uint64_t SpillsMovedPushPopMode;
+  static std::atomic_uint64_t SpillsMovedRegularMode;
+  static std::atomic_uint64_t SpillsMovedPushPopMode;
 
   Optional<unsigned> AnnotationIndex;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120218.410195.patch
Type: text/x-patch
Size: 1052 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220221/ad3361c3/attachment.bin>


More information about the llvm-commits mailing list