aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-27 08:11:15 +0000
committerChris Lattner <sabre@nondot.org>2010-02-27 08:11:15 +0000
commit247896272a8b812900b27ee85c8b1d347b4752d8 (patch)
treeea80a65eb8a105d66842b51ac3fc02d221c20185 /utils
parent9fcd72b71afda971915ff17614431a725811be4b (diff)
downloadexternal_llvm-247896272a8b812900b27ee85c8b1d347b4752d8.zip
external_llvm-247896272a8b812900b27ee85c8b1d347b4752d8.tar.gz
external_llvm-247896272a8b812900b27ee85c8b1d347b4752d8.tar.bz2
teach the optimizer that opcode == ISD::STORE is contradictory
with getType() == MVT::i32 etc. Teach it that two different integer constants are contradictory. This cuts 1K off the X86 table, down to 98k git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/DAGISelMatcher.cpp13
-rw-r--r--utils/TableGen/DAGISelMatcher.h1
-rw-r--r--utils/TableGen/DAGISelMatcherOpt.cpp12
3 files changed, 18 insertions, 8 deletions
diff --git a/utils/TableGen/DAGISelMatcher.cpp b/utils/TableGen/DAGISelMatcher.cpp
index dfb2361..601ac87 100644
--- a/utils/TableGen/DAGISelMatcher.cpp
+++ b/utils/TableGen/DAGISelMatcher.cpp
@@ -267,7 +267,12 @@ bool CheckOpcodeMatcher::isContradictoryImpl(const Matcher *M) const {
}
// TODO: CheckMultiOpcodeMatcher?
- // TODO: CheckType?
+
+ // This is a special common case we see a lot in the X86 backend, we know that
+ // ISD::STORE nodes can't have non-void type.
+ if (const CheckTypeMatcher *CT = dyn_cast<CheckTypeMatcher>(M))
+ return getOpcodeName() == "ISD::STORE" && CT->getType() != MVT::isVoid;
+
return false;
}
@@ -307,4 +312,8 @@ bool CheckChildTypeMatcher::isContradictoryImpl(const Matcher *M) const {
return false;
}
-
+bool CheckIntegerMatcher::isContradictoryImpl(const Matcher *M) const {
+ if (const CheckIntegerMatcher *CIM = dyn_cast<CheckIntegerMatcher>(M))
+ return CIM->getValue() != getValue();
+ return false;
+}
diff --git a/utils/TableGen/DAGISelMatcher.h b/utils/TableGen/DAGISelMatcher.h
index b4de0e4..f983f5a 100644
--- a/utils/TableGen/DAGISelMatcher.h
+++ b/utils/TableGen/DAGISelMatcher.h
@@ -511,6 +511,7 @@ private:
return cast<CheckIntegerMatcher>(M)->Value == Value;
}
virtual unsigned getHashImpl() const { return Value; }
+ virtual bool isContradictoryImpl(const Matcher *M) const;
};
/// CheckCondCodeMatcher - This checks to see if the current node is a
diff --git a/utils/TableGen/DAGISelMatcherOpt.cpp b/utils/TableGen/DAGISelMatcherOpt.cpp
index 045d501..d475dad 100644
--- a/utils/TableGen/DAGISelMatcherOpt.cpp
+++ b/utils/TableGen/DAGISelMatcherOpt.cpp
@@ -202,14 +202,14 @@ static void FactorNodes(OwningPtr<Matcher> &MatcherPtr) {
}
if (Scan != e) {
- DEBUG(errs() << "Couldn't merge this:\n ";
- Optn->printOne(errs());
- errs() << "into this:\n ";
- OptionsToMatch[OptionIdx]->printOne(errs());
+ DEBUG(errs() << "Couldn't merge this:\n";
+ Optn->print(errs(), 4);
+ errs() << "into this:\n";
+ OptionsToMatch[Scan]->print(errs(), 4);
if (OptionIdx+1 != e)
- OptionsToMatch[OptionIdx+1]->printOne(errs());
+ OptionsToMatch[Scan+1]->printOne(errs());
if (OptionIdx+2 < e)
- OptionsToMatch[OptionIdx+2]->printOne(errs());
+ OptionsToMatch[Scan+2]->printOne(errs());
errs() << "\n");
}