Index: lib/Target/X86/X86InstrFMA3Info.h =================================================================== --- lib/Target/X86/X86InstrFMA3Info.h +++ lib/Target/X86/X86InstrFMA3Info.h @@ -171,16 +171,6 @@ /// from the group. DenseMap OpcodeToGroup; - /// Creates groups of FMA opcodes and initializes Opcode-to-Group map. - /// This method can be called many times, but the actual initialization is - /// called only once. - static void initGroupsOnce(); - - /// Creates groups of FMA opcodes and initializes Opcode-to-Group map. - /// This method must be called ONLY from initGroupsOnce(). Otherwise, such - /// call is not thread safe. - void initGroupsOnceImpl(); - /// Creates one group of FMA opcodes having the register opcodes /// \p RegOpcodes and memory opcodes \p MemOpcodes. The parameter \p Attr /// specifies the attributes describing the created group. @@ -203,7 +193,7 @@ static X86InstrFMA3Info *getX86InstrFMA3Info(); /// Constructor. Just creates an object of the class. - X86InstrFMA3Info() = default; + X86InstrFMA3Info(); /// Destructor. Deallocates the memory used for FMA3 Groups. ~X86InstrFMA3Info() { @@ -222,9 +212,6 @@ /// \p Opcode is included. If the given \p Opcode is not recognized as FMA3 /// and not included into any FMA3 group, then nullptr is returned. static const X86InstrFMA3Group *getFMA3Group(unsigned Opcode) { - // Ensure that the groups of opcodes are initialized. - initGroupsOnce(); - // Find the group including the given opcode. const X86InstrFMA3Info *FMA3Info = getX86InstrFMA3Info(); auto I = FMA3Info->OpcodeToGroup.find(Opcode); @@ -292,7 +279,6 @@ /// Returns rm_iterator pointing to the first entry of OpcodeToGroup map /// with a register FMA opcode having memory form opcode equivalent. static rm_iterator rm_begin() { - initGroupsOnce(); const X86InstrFMA3Info *FMA3Info = getX86InstrFMA3Info(); auto I = FMA3Info->OpcodeToGroup.begin(); auto E = FMA3Info->OpcodeToGroup.end(); @@ -308,7 +294,6 @@ /// Returns the last rm_iterator. static rm_iterator rm_end() { - initGroupsOnce(); return rm_iterator(getX86InstrFMA3Info()->OpcodeToGroup.end()); } }; Index: lib/Target/X86/X86InstrFMA3Info.cpp =================================================================== --- lib/Target/X86/X86InstrFMA3Info.cpp +++ lib/Target/X86/X86InstrFMA3Info.cpp @@ -21,10 +21,6 @@ using namespace llvm; -/// This flag is used in the method llvm::call_once() used below to make the -/// initialization of the map 'OpcodeToGroup' thread safe. -static llvm::once_flag InitGroupsOnceFlag; - static ManagedStatic X86InstrFMA3InfoObj; X86InstrFMA3Info *X86InstrFMA3Info::getX86InstrFMA3Info() { return &*X86InstrFMA3InfoObj; @@ -264,7 +260,7 @@ FMA3_AVX512_VECTOR_GROUP(Name); \ FMA3_AVX512_SCALAR_GROUP(Name); -void X86InstrFMA3Info::initGroupsOnceImpl() { +X86InstrFMA3Info::X86InstrFMA3Info() { FMA3_AVX2_FULL_GROUP(VFMADD); FMA3_AVX2_FULL_GROUP(VFMSUB); FMA3_AVX2_FULL_GROUP(VFNMADD); @@ -281,8 +277,3 @@ FMA3_AVX512_VECTOR_GROUP(VFMADDSUB); FMA3_AVX512_VECTOR_GROUP(VFMSUBADD); } - -void X86InstrFMA3Info::initGroupsOnce() { - llvm::call_once(InitGroupsOnceFlag, - []() { getX86InstrFMA3Info()->initGroupsOnceImpl(); }); -}