diff options
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/MIRCanonicalizerPass.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp index 3f7e5cf052f..a68ea1934ae 100644 --- a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp +++ b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp @@ -120,7 +120,8 @@ rescheduleLexographically(std::vector<MachineInstr *> instructions, 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 @@ rescheduleLexographically(std::vector<MachineInstr *> instructions, // 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({ |

