diff options
author | Craig Topper <craig.topper@gmail.com> | 2015-11-24 08:20:42 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2015-11-24 08:20:42 +0000 |
commit | fef745c36ae76a392dee8062004728cd846a1f57 (patch) | |
tree | 18f473de085cf185b8cf183d15dfd5c2e4f3336d /llvm/utils/TableGen/CodeGenDAGPatterns.cpp | |
parent | 4856c81b46a662e093f21fdfb06fb8a1b89ee39a (diff) | |
download | bcm5719-llvm-fef745c36ae76a392dee8062004728cd846a1f57.tar.gz bcm5719-llvm-fef745c36ae76a392dee8062004728cd846a1f57.zip |
[TableGen] Use std::set_intersection to merge TypeSets. NFC
llvm-svn: 253961
Diffstat (limited to 'llvm/utils/TableGen/CodeGenDAGPatterns.cpp')
-rw-r--r-- | llvm/utils/TableGen/CodeGenDAGPatterns.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index 415511123d2..35b6bf4416b 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -203,21 +203,20 @@ bool EEVT::TypeSet::MergeInTypeInfo(const EEVT::TypeSet &InVT, TreePattern &TP){ // If this is a type list and the RHS is a typelist as well, eliminate entries // from this list that aren't in the other one. - bool MadeChange = false; TypeSet InputSet(*this); - for (unsigned i = 0; i != TypeVec.size(); ++i) { - if (std::find(InVT.TypeVec.begin(), InVT.TypeVec.end(), TypeVec[i]) != - InVT.TypeVec.end()) - continue; + TypeVec.clear(); + std::set_intersection(InputSet.TypeVec.begin(), InputSet.TypeVec.end(), + InVT.TypeVec.begin(), InVT.TypeVec.end(), + std::back_inserter(TypeVec)); - TypeVec.erase(TypeVec.begin()+i--); - MadeChange = true; - } + // If the intersection is the same size as the original set then we're done. + if (TypeVec.size() == InputSet.TypeVec.size()) + return false; // If we removed all of our types, we have a type contradiction. if (!TypeVec.empty()) - return MadeChange; + return true; // FIXME: Really want an SMLoc here! TP.error("Type inference contradiction found, merging '" + |