From: Chris Lattner Date: Fri, 14 Oct 2005 03:54:49 +0000 (+0000) Subject: Do not let getLegalValueTypes return a list with duplicates in it X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=75ee2eb4e20f74a14ebb78aad03b15555c53043d;p=oota-llvm.git Do not let getLegalValueTypes return a list with duplicates in it git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23723 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index f0fdeae9456..1b3605a273c 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -19,6 +19,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Support/CommandLine.h" #include +#include using namespace llvm; static cl::opt @@ -179,6 +180,12 @@ void CodeGenTarget::ReadLegalValueTypes() const { const std::vector &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()); }