[llvm] af620fc - Revert "[AMDGPU] Fix data race on RegisterBank initialization."

Huihui Zhang via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 11:17:03 PST 2020


Author: Huihui Zhang
Date: 2020-01-29T11:16:27-08:00
New Revision: af620fc36a2c7f60a88236a573326b6f1ffa1d79

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

LOG: Revert "[AMDGPU] Fix data race on RegisterBank initialization."

There looks to be buildbot failure related.

This reverts commit 8bb6c8a22af845618cfd6c27853dca1b48d30ce0.

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
index 3007d7eead86..476ab798d004 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
@@ -197,15 +197,15 @@ AMDGPURegisterBankInfo::AMDGPURegisterBankInfo(const GCNSubtarget &ST)
       TII(Subtarget.getInstrInfo()) {
 
   // HACK: Until this is fully tablegen'd.
-  static llvm::once_flag InitializeRegisterBankFlag;
+  static bool AlreadyInit = false;
+  if (AlreadyInit)
+    return;
 
-  static auto InitializeRegisterBankOnce = [this]() {
-    assert(&getRegBank(AMDGPU::SGPRRegBankID) == &AMDGPU::SGPRRegBank &&
-           &getRegBank(AMDGPU::VGPRRegBankID) == &AMDGPU::VGPRRegBank &&
-           &getRegBank(AMDGPU::AGPRRegBankID) == &AMDGPU::AGPRRegBank);
-  };
+  AlreadyInit = true;
 
-  llvm::call_once(InitializeRegisterBankFlag, InitializeRegisterBankOnce);
+  assert(&getRegBank(AMDGPU::SGPRRegBankID) == &AMDGPU::SGPRRegBank &&
+         &getRegBank(AMDGPU::VGPRRegBankID) == &AMDGPU::VGPRRegBank &&
+         &getRegBank(AMDGPU::AGPRRegBankID) == &AMDGPU::AGPRRegBank);
 }
 
 static bool isVectorRegisterBank(const RegisterBank &Bank) {


        


More information about the llvm-commits mailing list