[AMDGPU] Fix data race on RegisterBank initialization.
authorHuihui Zhang <huihuiz@quicinc.com>
Wed, 29 Jan 2020 18:14:30 +0000 (10:14 -0800)
committerHuihui Zhang <huihuiz@quicinc.com>
Wed, 29 Jan 2020 18:14:40 +0000 (10:14 -0800)
commit8bb6c8a22af845618cfd6c27853dca1b48d30ce0
tree2068620cf3675bf31532a66c7a0f58f935b54fba
parenta5a4a47d691459afffc552bd3be7abfc86a49793
[AMDGPU] Fix data race on RegisterBank initialization.

Summary:
The initialization of RegisterBank needs to be done only once. The
logic of AlreadyInit has data race, use llvm::call_once instead.

This is continuing work of D73587.

Reviewers: arsenm, tstellar, ronlieb, efriedma, apazos, nhaehnle

Reviewed By: nhaehnle

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73604
llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp