[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Jim Laskey jlaskey at apple.com
Fri Dec 23 12:08:40 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.74 -> 1.75
---
Log message:

Remove redundant debug locations.


---
Diffs of the changes:  (+34 -0)

 DAGCombiner.cpp |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.74 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.75
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.74	Thu Dec 22 23:48:07 2005
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Fri Dec 23 14:08:28 2005
@@ -175,6 +175,9 @@
     SDOperand visitLOAD(SDNode *N);
     SDOperand visitSTORE(SDNode *N);
 
+    SDOperand visitLOCATION(SDNode *N);
+    SDOperand visitDEBUGLOC(SDNode *N);
+
     bool SimplifySelectOps(SDNode *SELECT, SDOperand LHS, SDOperand RHS);
     SDOperand SimplifySelect(SDOperand N0, SDOperand N1, SDOperand N2);
     SDOperand SimplifySelectCC(SDOperand N0, SDOperand N1, SDOperand N2, 
@@ -631,6 +634,8 @@
   case ISD::BRTWOWAY_CC:        return visitBRTWOWAY_CC(N);
   case ISD::LOAD:               return visitLOAD(N);
   case ISD::STORE:              return visitSTORE(N);
+  case ISD::LOCATION:           return visitLOCATION(N);
+  case ISD::DEBUG_LOC:          return visitDEBUGLOC(N);
   }
   return SDOperand();
 }
@@ -2089,6 +2094,35 @@
   return SDOperand();
 }
 
+SDOperand DAGCombiner::visitLOCATION(SDNode *N) {
+  SDOperand Chain    = N->getOperand(0);
+  
+  // Remove redundant locations (last one holds)
+  if (Chain.getOpcode() == ISD::LOCATION && Chain.hasOneUse()) {
+    return DAG.getNode(ISD::LOCATION, MVT::Other, Chain.getOperand(0),
+                                                  N->getOperand(1),
+                                                  N->getOperand(2),
+                                                  N->getOperand(3),
+                                                  N->getOperand(4));
+  }
+  
+  return SDOperand();
+}
+
+SDOperand DAGCombiner::visitDEBUGLOC(SDNode *N) {
+  SDOperand Chain    = N->getOperand(0);
+  
+  // Remove redundant debug locations (last one holds)
+  if (Chain.getOpcode() == ISD::DEBUG_LOC && Chain.hasOneUse()) {
+    return DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Chain.getOperand(0),
+                                                   N->getOperand(1),
+                                                   N->getOperand(2),
+                                                   N->getOperand(3));
+  }
+  
+  return SDOperand();
+}
+
 SDOperand DAGCombiner::SimplifySelect(SDOperand N0, SDOperand N1, SDOperand N2){
   assert(N0.getOpcode() ==ISD::SETCC && "First argument must be a SetCC node!");
   






More information about the llvm-commits mailing list