[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp
Evan Cheng
evan.cheng at apple.com
Mon Dec 12 15:23:00 PST 2005
Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.95 -> 1.96
---
Log message:
At top of generated isel SelectCode() is this:
if (!N.Val->hasOneUse()) {
std::map<SDOperand, SDOperand>::iterator CGMI = CodeGenMap.find(N);
if (CGMI != CodeGenMap.end()) return CGMI->second;
}
Suppose a DAG like this:
X
^ ^
/ \
USE1 USE2
Suppose USE1 is being selected first and during which X is selected and
returned a new node. After this, USE1 is no longer an use of X. During USE2
selection, X will be selected again since it has only one use!
The fix is to always query CodeGenMap.
---
Diffs of the changes: (+2 -4)
DAGISelEmitter.cpp | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.95 llvm/utils/TableGen/DAGISelEmitter.cpp:1.96
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.95 Mon Dec 12 13:37:43 2005
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Mon Dec 12 17:22:48 2005
@@ -2234,10 +2234,8 @@
<< " N.getOpcode() < (ISD::BUILTIN_OP_END+" << InstNS
<< "INSTRUCTION_LIST_END))\n"
<< " return N; // Already selected.\n\n"
- << " if (!N.Val->hasOneUse()) {\n"
- << " std::map<SDOperand, SDOperand>::iterator CGMI = CodeGenMap.find(N);\n"
- << " if (CGMI != CodeGenMap.end()) return CGMI->second;\n"
- << " }\n"
+ << " std::map<SDOperand, SDOperand>::iterator CGMI = CodeGenMap.find(N);\n"
+ << " if (CGMI != CodeGenMap.end()) return CGMI->second;\n"
<< " switch (N.getOpcode()) {\n"
<< " default: break;\n"
<< " case ISD::EntryToken: // These leaves remain the same.\n"
More information about the llvm-commits
mailing list