diff options
author | Jim Laskey <jlaskey@mac.com> | 2005-12-23 20:08:28 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2005-12-23 20:08:28 +0000 |
commit | bdba3e2a469cda968b09a6507b92b8184ca2b251 (patch) | |
tree | ea90cb883cffc8a04d3709b6b2c3964b893e4c54 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 4621dc8861c1ab8a1bb155c17f5ed457861020b1 (diff) | |
download | bcm5719-llvm-bdba3e2a469cda968b09a6507b92b8184ca2b251.tar.gz bcm5719-llvm-bdba3e2a469cda968b09a6507b92b8184ca2b251.zip |
Remove redundant debug locations.
llvm-svn: 24995
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 52e8391f372..30a4c9f637c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -175,6 +175,9 @@ namespace { 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 @@ SDOperand DAGCombiner::visit(SDNode *N) { 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 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) { 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!"); |