diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h index 2e3507386df30..e97e01839f73b 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAG.h +++ b/llvm/include/llvm/CodeGen/SelectionDAG.h @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -247,6 +248,9 @@ class SelectionDAG { BlockFrequencyInfo *BFI = nullptr; MachineModuleInfo *MMI = nullptr; + /// Extended EVTs used for single value VTLists. + std::set EVTs; + /// List of non-single value types. FoldingSet VTListMap; diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h index 677b59e0c8fbe..61f3c6329efce 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h @@ -664,7 +664,7 @@ END_TWO_BYTE_PACK() DebugLoc debugLoc; /// Return a pointer to the specified value type. - static const EVT *getValueTypeList(EVT VT); + static const EVT *getValueTypeList(MVT VT); /// Index in worklist of DAGCombiner, or negative if the node is not in the /// worklist. -1 = not in worklist; -2 = not in worklist, but has already been @@ -1124,7 +1124,7 @@ END_TWO_BYTE_PACK() void addUse(SDUse &U) { U.addToList(&UseList); } protected: - static SDVTList getSDVTList(EVT VT) { + static SDVTList getSDVTList(MVT VT) { SDVTList Ret = { getValueTypeList(VT), 1 }; return Ret; } diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 182529123ec6d..1b39b75d2687f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -10623,7 +10623,10 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, } SDVTList SelectionDAG::getVTList(EVT VT) { - return makeVTList(SDNode::getValueTypeList(VT), 1); + if (!VT.isExtended()) + return makeVTList(SDNode::getValueTypeList(VT.getSimpleVT()), 1); + + return makeVTList(&(*EVTs.insert(VT).first), 1); } SDVTList SelectionDAG::getVTList(EVT VT1, EVT VT2) { @@ -12383,17 +12386,11 @@ namespace { /// getValueTypeList - Return a pointer to the specified value type. /// -const EVT *SDNode::getValueTypeList(EVT VT) { - static std::set EVTs; +const EVT *SDNode::getValueTypeList(MVT VT) { static EVTArray SimpleVTArray; - static sys::SmartMutex VTMutex; - if (VT.isExtended()) { - sys::SmartScopedLock Lock(VTMutex); - return &(*EVTs.insert(VT).first); - } - assert(VT.getSimpleVT() < MVT::VALUETYPE_SIZE && "Value type out of range!"); - return &SimpleVTArray.VTs[VT.getSimpleVT().SimpleTy]; + assert(VT < MVT::VALUETYPE_SIZE && "Value type out of range!"); + return &SimpleVTArray.VTs[VT.SimpleTy]; } /// hasNUsesOfValue - Return true if there are exactly NUSES uses of the