diff options
author | Chris Lattner <sabre@nondot.org> | 2006-10-14 03:52:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-10-14 03:52:46 +0000 |
commit | 6a1b2de8c4e34c55ef4c2e530ba6507ec41f8e0c (patch) | |
tree | e71c85296abbd1c8ca615dacecb34babc27bc89c /llvm/lib/CodeGen | |
parent | d0cc3bdfc3fe0f8bc3519857585b85e15a23ca94 (diff) | |
download | bcm5719-llvm-6a1b2de8c4e34c55ef4c2e530ba6507ec41f8e0c.tar.gz bcm5719-llvm-6a1b2de8c4e34c55ef4c2e530ba6507ec41f8e0c.zip |
Make sure that the node returned by SimplifySetCC is added to the worklist
so that it can be deleted if unused.
llvm-svn: 30955
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index de858539c67..2ee98f0654d 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1845,6 +1845,7 @@ SDOperand DAGCombiner::visitSELECT_CC(SDNode *N) { // Determine if the condition we're dealing with is constant SDOperand SCC = SimplifySetCC(TLI.getSetCCResultTy(), N0, N1, CC, false); + if (SCC.Val) AddToWorkList(SCC.Val); if (ConstantSDNode *SCCC = dyn_cast_or_null<ConstantSDNode>(SCC.Val)) { if (SCCC->getValue()) @@ -2660,6 +2661,8 @@ SDOperand DAGCombiner::visitBR_CC(SDNode *N) { // Use SimplifySetCC to simplify SETCC's. SDOperand Simp = SimplifySetCC(MVT::i1, CondLHS, CondRHS, CC->get(), false); + if (Simp.Val) AddToWorkList(Simp.Val); + ConstantSDNode *SCCC = dyn_cast_or_null<ConstantSDNode>(Simp.Val); // fold br_cc true, dest -> br dest (unconditional branch) @@ -2669,6 +2672,7 @@ SDOperand DAGCombiner::visitBR_CC(SDNode *N) { // fold br_cc false, dest -> unconditional fall through if (SCCC && SCCC->isNullValue()) return N->getOperand(0); + // fold to a simpler setcc if (Simp.Val && Simp.getOpcode() == ISD::SETCC) return DAG.getNode(ISD::BR_CC, MVT::Other, N->getOperand(0), @@ -3424,6 +3428,7 @@ SDOperand DAGCombiner::SimplifySelectCC(SDOperand N0, SDOperand N1, // Determine if the condition we're dealing with is constant SDOperand SCC = SimplifySetCC(TLI.getSetCCResultTy(), N0, N1, CC, false); + if (SCC.Val) AddToWorkList(SCC.Val); ConstantSDNode *SCCC = dyn_cast_or_null<ConstantSDNode>(SCC.Val); // fold select_cc true, x, y -> x |