aboutsummaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenTarget.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-10-14 03:54:49 +0000
committerChris Lattner <sabre@nondot.org>2005-10-14 03:54:49 +0000
commit75ee2eb4e20f74a14ebb78aad03b15555c53043d (patch)
treef2f727738cf3ab35ca1446ceb959557951680faa /utils/TableGen/CodeGenTarget.cpp
parent216def8ecfb8d2b03520a4fe004d498ad7b8b1c9 (diff)
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
Diffstat (limited to 'utils/TableGen/CodeGenTarget.cpp')
-rw-r--r--utils/TableGen/CodeGenTarget.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp
index f0fdeae945..1b3605a273 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 <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());
}