Skip to content

Commit 3bc26b1

Browse files
committed
Better init
1 parent a6cb7fb commit 3bc26b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mlir/lib/Target/LLVMIR/Transforms/TargetUtils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "mlir/Target/LLVMIR/Import.h"
1313

1414
#include "llvm/MC/TargetRegistry.h"
15-
#include "llvm/Support/Debug.h"
1615
#include "llvm/Support/DebugLog.h"
1716
#include "llvm/Support/TargetSelect.h"
1817
#include "llvm/Target/TargetMachine.h"
@@ -25,13 +24,14 @@ namespace mlir {
2524
namespace LLVM {
2625
namespace detail {
2726
void initializeBackendsOnce() {
28-
static llvm::once_flag initializeOnceFlag;
29-
llvm::call_once(initializeOnceFlag, []() {
27+
static const auto initOnce = [] {
3028
// Ensure that the targets, that LLVM has been configured to support,
3129
// are loaded into the TargetRegistry.
3230
llvm::InitializeAllTargets();
3331
llvm::InitializeAllTargetMCs();
34-
});
32+
return true;
33+
}();
34+
(void)initOnce; // Dummy usage.
3535
}
3636

3737
FailureOr<std::unique_ptr<llvm::TargetMachine>>

0 commit comments

Comments
 (0)