summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-09-14 23:54:24 +0000
committerChris Lattner <sabre@nondot.org>2006-09-14 23:54:24 +0000
commit3ffda067e3b91fd33c9cae8ecc9331668cac075d (patch)
tree284c10192c02cb94ca48ac27306a6e4249a762ce
parent9ce9df59129c00afd15ebdd50ff3cfb0ce1a2d2f (diff)
downloadbcm5719-llvm-3ffda067e3b91fd33c9cae8ecc9331668cac075d.tar.gz
bcm5719-llvm-3ffda067e3b91fd33c9cae8ecc9331668cac075d.zip
Relax this check.
llvm-svn: 30381
-rw-r--r--llvm/utils/TableGen/DAGISelEmitter.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp
index c8dd50e9c44..4d4fa9dabd0 100644
--- a/llvm/utils/TableGen/DAGISelEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelEmitter.cpp
@@ -824,13 +824,16 @@ bool TreePatternNode::canPatternMatch(std::string &Reason, DAGISelEmitter &ISE){
const SDNodeInfo &NodeInfo = ISE.getSDNodeInfo(getOperator());
if (NodeInfo.hasProperty(SDNodeInfo::SDNPCommutative)) {
// Scan all of the operands of the node and make sure that only the last one
- // is a constant node.
- for (unsigned i = 0, e = getNumChildren()-1; i != e; ++i)
- if (!getChild(i)->isLeaf() &&
- getChild(i)->getOperator()->getName() == "imm") {
- Reason = "Immediate value must be on the RHS of commutative operators!";
- return false;
- }
+ // is a constant node, unless the RHS also is.
+ if (getChild(getNumChildren()-1)->isLeaf() ||
+ getChild(getNumChildren()-1)->getOperator()->getName() != "imm") {
+ for (unsigned i = 0, e = getNumChildren()-1; i != e; ++i)
+ if (!getChild(i)->isLeaf() &&
+ getChild(i)->getOperator()->getName() == "imm") {
+ Reason = "Immediate value must be on the RHS of commutative operators!";
+ return false;
+ }
+ }
}
return true;
OpenPOWER on IntegriCloud