summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-02 17:01:57 +0000
committerChris Lattner <sabre@nondot.org>2008-07-02 17:01:57 +0000
commit349db1738d58d52cae2ab1e06cbd128dd9f0aab6 (patch)
treedbbf4ea90eef36b283d1bbb913f4523655e47fee /lib
parent9d3edca443d1110db1ce3b604a10c5e5d0cce22d (diff)
downloadllvm-349db1738d58d52cae2ab1e06cbd128dd9f0aab6.tar.gz
llvm-349db1738d58d52cae2ab1e06cbd128dd9f0aab6.tar.bz2
llvm-349db1738d58d52cae2ab1e06cbd128dd9f0aab6.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53030 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 0a23966f31..b22bf1dc62 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/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();