Do not let getLegalValueTypes return a list with duplicates in it

llvm-svn: 23723
This commit is contained in:
Chris Lattner 2005-10-14 03:54:49 +00:00
parent 6e673b24d3
commit 90c5b9c83c
1 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
#include <set>
#include <algorithm>
using namespace llvm;
static cl::opt<unsigned>
@ -179,6 +180,12 @@ void CodeGenTarget::ReadLegalValueTypes() const {
const std::vector<CodeGenRegisterClass> &RCs = getRegisterClasses();
for (unsigned i = 0, e = RCs.size(); i != e; ++i)
LegalValueTypes.push_back(RCs[i].VT);
// Remove duplicates.
std::sort(LegalValueTypes.begin(), LegalValueTypes.end());
LegalValueTypes.erase(std::unique(LegalValueTypes.begin(),
LegalValueTypes.end()),
LegalValueTypes.end());
}