aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-09-11 02:24:43 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-09-11 02:24:43 +0000
commit966fd37ba574930658c83710952df5d00a8fed92 (patch)
tree9886a280e5bb26d1c4e5ede985e76bb75937c684
parent734503be5965237e7eed978837ff280a9fadf403 (diff)
downloadexternal_llvm-966fd37ba574930658c83710952df5d00a8fed92.zip
external_llvm-966fd37ba574930658c83710952df5d00a8fed92.tar.gz
external_llvm-966fd37ba574930658c83710952df5d00a8fed92.tar.bz2
1) With X86 lowering change, the following can no longer happen since
the branch's chain is also produced by cmp. [ch, r : ld] ^ ^ | | [XX]--/ \- [flag : cmp] ^ ^ | | \---[br flag]- Remove an isel check which prevents loads from being folded into cmp / test instructions. 2) Whenever possible, delete a selected node to allow more load folding opportunities. Note not all nodes can be deleted after it has been selected. Some may have simply morphed; some have not changed at all (e.g. EntryToken). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30242 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp35
1 files changed, 16 insertions, 19 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 53934fa..c8dd50e 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -2246,24 +2246,6 @@ public:
emitCheck(RootName + ".hasOneUse()");
EmittedUseCheck = true;
if (NodeHasChain) {
- // FIXME: Don't fold if 1) the parent node writes a flag, 2) the node
- // has a chain use.
- // This a workaround for this problem:
- //
- // [ch, r : ld]
- // ^ ^
- // | |
- // [XX]--/ \- [flag : cmp]
- // ^ ^
- // | |
- // \---[br flag]-
- //
- // cmp + br should be considered as a single node as they are flagged
- // together. So, if the ld is folded into the cmp, the XX node in the
- // graph is now both an operand and a use of the ld/cmp/br node.
- if (NodeHasProperty(P, SDNodeInfo::SDNPOutFlag, ISE))
- emitCheck(ParentName + ".Val->isOnlyUse(" + RootName + ".Val)");
-
// If the immediate use can somehow reach this node through another
// path, then can't fold it either or it will create a cycle.
// e.g. In the following diagram, XX can reach ld through YY. If
@@ -3629,6 +3611,16 @@ OS << " unsigned NumKilled = ISelKilled.size();\n";
OS << " RemoveKilled();\n";
OS << "}\n\n";
+ OS << "void DeleteNode(SDNode *N) {\n";
+ OS << " CurDAG->DeleteNode(N);\n";
+ OS << " for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); "
+ << "I != E; ++I) {\n";
+ OS << " SDNode *Operand = I->Val;\n";
+ OS << " if (Operand->use_empty())\n";
+ OS << " DeleteNode(Operand);\n";
+ OS << " }\n";
+ OS << "}\n";
+
OS << "// SelectRoot - Top level entry to DAG isel.\n";
OS << "SDOperand SelectRoot(SDOperand Root) {\n";
OS << " SelectRootInit();\n";
@@ -3649,7 +3641,12 @@ OS << " unsigned NumKilled = ISelKilled.size();\n";
OS << " ISelQueue.pop_back();\n";
OS << " if (!isSelected(Node->getNodeId())) {\n";
OS << " SDNode *ResNode = Select(SDOperand(Node, 0));\n";
- OS << " if (ResNode && ResNode != Node) ReplaceUses(Node, ResNode);\n";
+ OS << " if (ResNode != Node) {\n";
+ OS << " if (ResNode)\n";
+ OS << " ReplaceUses(Node, ResNode);\n";
+ OS << " if (Node->use_empty()) // Don't delete EntryToken, etc.\n";
+ OS << " DeleteNode(Node);\n";
+ OS << " }\n";
OS << " }\n";
OS << " }\n";
OS << "\n";