diff --git a/utils/TableGen/CodeGenSchedule.cpp b/utils/TableGen/CodeGenSchedule.cpp index f1bfe42001a..8b54ff0d1d7 100644 --- a/utils/TableGen/CodeGenSchedule.cpp +++ b/utils/TableGen/CodeGenSchedule.cpp @@ -1718,6 +1718,9 @@ std::vector CodeGenSchedModels::getAllProcIndices() const { for (const auto &PM : ProcModelMap) if (PM.second != 0) ProcIdVec.push_back(PM.second); + // The order of the keys (Record pointers) of ProcModelMap are not stable. + // Sort to stabalize the values. + llvm::sort(ProcIdVec); return ProcIdVec; } diff --git a/utils/TableGen/CodeGenSchedule.h b/utils/TableGen/CodeGenSchedule.h index 3fa642607b6..9020447c940 100644 --- a/utils/TableGen/CodeGenSchedule.h +++ b/utils/TableGen/CodeGenSchedule.h @@ -410,7 +410,7 @@ public: ArrayRef getGroups() const { return Groups; } }; -using ProcModelMapTy = std::map; +using ProcModelMapTy = DenseMap; /// Top level container for machine model data. class CodeGenSchedModels {