[NFC] MIR-Canon: switching to a stable string sorting of instructions.

llvm-svn: 332191
diff --git a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
index 3f7e5cf..a68ea19 100644
--- a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
+++ b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
@@ -120,7 +120,8 @@
                           std::function<MachineBasicBlock::iterator()> getPos) {
 
   bool Changed = false;
-  std::map<std::string, MachineInstr *> StringInstrMap;
+  using StringInstrPair = std::pair<std::string, MachineInstr *>;
+  std::vector<StringInstrPair> StringInstrMap;
 
   for (auto *II : instructions) {
     std::string S;
@@ -130,9 +131,14 @@
 
     // Trim the assignment, or start from the begining in the case of a store.
     const size_t i = S.find("=");
-    StringInstrMap.insert({(i == std::string::npos) ? S : S.substr(i), II});
+    StringInstrMap.push_back({(i == std::string::npos) ? S : S.substr(i), II});
   }
 
+  std::sort(StringInstrMap.begin(), StringInstrMap.end(),
+            [](StringInstrPair &a, StringInstrPair &b) {
+              return (a.first < b.first);
+            });
+
   for (auto &II : StringInstrMap) {
 
     DEBUG({