Use std::set_union instead of nasty custom code.

I just noticed Jakob's examples of the proper application of
std::set... routines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153918 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick 2012-04-03 00:47:23 +00:00
parent 6126a1e189
commit f1275959b2

View File

@ -91,21 +91,11 @@ const std::string &CodeGenRegister::getName() const {
// Merge two RegUnitLists maintaining the order and removing duplicates.
// Overwrites MergedRU in the process.
static void mergeRegUnits(CodeGenRegister::RegUnitList &MergedRU,
const CodeGenRegister::RegUnitList &RRU)
{
const CodeGenRegister::RegUnitList &RRU) {
CodeGenRegister::RegUnitList LRU = MergedRU;
MergedRU.clear();
for (CodeGenRegister::RegUnitList::const_iterator
RI = RRU.begin(), RE = RRU.end(), LI = LRU.begin(), LE = LRU.end();
RI != RE || LI != LE;) {
CodeGenRegister::RegUnitList::const_iterator &NextI =
(RI != RE && (LI == LE || *RI < *LI)) ? RI : LI;
if (MergedRU.empty() || *NextI != MergedRU.back())
MergedRU.push_back(*NextI);
++NextI;
}
std::set_union(LRU.begin(), LRU.end(), RRU.begin(), RRU.end(),
std::inserter(MergedRU, MergedRU.begin()));
}
const CodeGenRegister::SubRegMap &