diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-11 06:43:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-11 06:43:25 +0000 |
commit | c5f85d37381d0a2db3f33e9a474fbd76939015c5 (patch) | |
tree | 3f640ae40dcca5e550ac853bb368e7866ea8a603 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 20f2372a7c89759d215561dad5ec6223f0400e63 (diff) | |
download | bcm5719-llvm-c5f85d37381d0a2db3f33e9a474fbd76939015c5.tar.gz bcm5719-llvm-c5f85d37381d0a2db3f33e9a474fbd76939015c5.zip |
don't create shifts by zero, fix some problems with my previous patch
llvm-svn: 35887
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index eb63647b436..2c9d41cc577 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2136,7 +2136,7 @@ SDOperand DAGCombiner::visitSIGN_EXTEND(SDNode *N) { SimplifySelectCC(N0.getOperand(0), N0.getOperand(1), DAG.getConstant(~0ULL, VT), DAG.getConstant(0, VT), cast<CondCodeSDNode>(N0.getOperand(2))->get()); - if (SCC.Val) return SCC; + if (SCC.Val && SCC.Val != N) return SCC; } return SDOperand(); @@ -2226,7 +2226,7 @@ SDOperand DAGCombiner::visitZERO_EXTEND(SDNode *N) { SimplifySelectCC(N0.getOperand(0), N0.getOperand(1), DAG.getConstant(1, VT), DAG.getConstant(0, VT), cast<CondCodeSDNode>(N0.getOperand(2))->get()); - if (SCC.Val) return SCC; + if (SCC.Val && SCC.Val != N) return SCC; } return SDOperand(); @@ -2320,7 +2320,8 @@ SDOperand DAGCombiner::visitANY_EXTEND(SDNode *N) { SimplifySelectCC(N0.getOperand(0), N0.getOperand(1), DAG.getConstant(1, VT), DAG.getConstant(0, VT), cast<CondCodeSDNode>(N0.getOperand(2))->get()); - if (SCC.Val) return SCC; + if (SCC.Val && SCC.Val != N && SCC.getOpcode() != ISD::ZERO_EXTEND) + return SCC; } return SDOperand(); @@ -4139,6 +4140,9 @@ SDOperand DAGCombiner::SimplifySelectCC(SDOperand N0, SDOperand N1, } AddToWorkList(SCC.Val); AddToWorkList(Temp.Val); + + if (N2C->getValue() == 1) + return Temp; // shl setcc result by log2 n2c return DAG.getNode(ISD::SHL, N2.getValueType(), Temp, DAG.getConstant(Log2_64(N2C->getValue()), |