diff options
| author | Dale Johannesen <dalej@apple.com> | 2007-12-06 17:53:31 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2007-12-06 17:53:31 +0000 |
| commit | 5eff4de9c8b1a6c9e921a2ebc79ec24eb82460c1 (patch) | |
| tree | bff09aa6edb4d95dba901a4198b23d5436e3e985 /llvm/lib/CodeGen | |
| parent | 6b644a6e05e8d05ca4cf437fdede5b3e8b85601f (diff) | |
| download | bcm5719-llvm-5eff4de9c8b1a6c9e921a2ebc79ec24eb82460c1.tar.gz bcm5719-llvm-5eff4de9c8b1a6c9e921a2ebc79ec24eb82460c1.zip | |
Redo previous patch so optimization only done for i1.
Simpler and safer.
llvm-svn: 44663
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index fd0df3a0a11..1400c3ee4f9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2455,10 +2455,6 @@ SDOperand DAGCombiner::visitSELECT(SDNode *N) { MVT::ValueType VT = N->getValueType(0); MVT::ValueType VT0 = N0.getValueType(); - - // Some targets have SETCC types bigger than 1 bit, but do not set all the - // bits to 1; identified by getSetCCResultContents. Watch out for these. - // fold select C, X, X -> X if (N1 == N2) return N1; @@ -2483,22 +2479,14 @@ SDOperand DAGCombiner::visitSELECT(SDNode *N) { return DAG.getNode(ISD::TRUNCATE, VT, XORNode); } // fold select C, 0, X -> ~C & X - if (VT == VT0 && N1C && N1C->isNullValue() && - (N0.Val->getOpcode()!=ISD::SETCC || VT==MVT::i1 || - TLI.getSetCCResultContents()== - TargetLowering::ZeroOrNegativeOneSetCCResult)) { - SDOperand XORNode; - XORNode = DAG.getNode(ISD::XOR, VT, N0, DAG.getConstant(~0UL, VT)); + if (VT == VT0 && VT == MVT::i1 && N1C && N1C->isNullValue()) { + SDOperand XORNode = DAG.getNode(ISD::XOR, VT, N0, DAG.getConstant(1, VT)); AddToWorkList(XORNode.Val); return DAG.getNode(ISD::AND, VT, XORNode, N2); } // fold select C, X, 1 -> ~C | X - if (VT == VT0 && N2C && N2C->getValue() == 1 && - (N0.Val->getOpcode()!=ISD::SETCC || VT==MVT::i1 || - TLI.getSetCCResultContents()== - TargetLowering::ZeroOrNegativeOneSetCCResult)) { - SDOperand XORNode; - XORNode = DAG.getNode(ISD::XOR, VT, N0, DAG.getConstant(~0UL, VT)); + if (VT == VT0 && VT == MVT::i1 && N2C && N2C->getValue() == 1) { + SDOperand XORNode = DAG.getNode(ISD::XOR, VT, N0, DAG.getConstant(1, VT)); AddToWorkList(XORNode.Val); return DAG.getNode(ISD::OR, VT, XORNode, N1); } |

