diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-02 17:01:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-02 17:01:57 +0000 |
commit | 6b2c4f6143bea4a28e5a8816842d79d7b11b382c (patch) | |
tree | 0976c1e98a2603cbac4f39cbead3a0fdb730d36e /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 71ac83246fe4638b1fb2bb673b840199acbc107a (diff) | |
download | bcm5719-llvm-6b2c4f6143bea4a28e5a8816842d79d7b11b382c.tar.gz bcm5719-llvm-6b2c4f6143bea4a28e5a8816842d79d7b11b382c.zip |
instead of aborting on shifts of i1, just implicitly fold them.
The dag combiner can produce a shift of i1 when folding icmp i1's.
llvm-svn: 53030
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 0a23966f31f..b22bf1dc621 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2192,7 +2192,13 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT VT, assert(VT == N1.getValueType() && "Shift operators return type must be the same as their first arg"); assert(VT.isInteger() && N2.getValueType().isInteger() && - VT != MVT::i1 && "Shifts only work on integers"); + "Shifts only work on integers"); + + // Always fold shifts of i1 values so the code generator doesn't need to + // handle them. Since we know the size of the shift has to be less than the + // size of the value, the shift/rotate count is guaranteed to be zero. + if (VT == MVT::i1) + return N1; break; case ISD::FP_ROUND_INREG: { MVT EVT = cast<VTSDNode>(N2)->getVT(); |