[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Sep 2 12:36:29 PDT 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAG.cpp updated: 1.184 -> 1.185
---
Log message:
Make sure to auto-cse nullary ops
---
Diffs of the changes: (+9 -3)
SelectionDAG.cpp | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.184 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.185
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.184 Fri Sep 2 14:15:44 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Sep 2 14:36:17 2005
@@ -326,7 +326,10 @@
break;
default:
if (N->getNumValues() == 1) {
- if (N->getNumOperands() == 1) {
+ if (N->getNumOperands() == 0) {
+ Erased = NullaryOps.erase(std::make_pair(N->getOpcode(),
+ N->getValueType(0)));
+ } else if (N->getNumOperands() == 1) {
Erased =
UnaryOps.erase(std::make_pair(N->getOpcode(),
std::make_pair(N->getOperand(0),
@@ -1010,8 +1013,11 @@
/// getNode - Gets or creates the specified node.
///
SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT) {
- SDNode *N = new SDNode(Opcode, VT);
- AllNodes.push_back(N);
+ SDNode *&N = NullaryOps[std::make_pair(Opcode, VT)];
+ if (!N) {
+ N = new SDNode(Opcode, VT);
+ AllNodes.push_back(N);
+ }
return SDOperand(N, 0);
}
More information about the llvm-commits
mailing list