aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-01-15 21:19:37 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-01-15 21:19:37 +0000
commit5df5a22d1a098961edebac59fbddcab045fddd29 (patch)
treed86546a4153bc4b3a6cbe2b482c9b5dff3284b17 /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parent28f0ed5c9de4a68f34c0219d4ab83652c4647150 (diff)
downloadexternal_llvm-5df5a22d1a098961edebac59fbddcab045fddd29.zip
external_llvm-5df5a22d1a098961edebac59fbddcab045fddd29.tar.gz
external_llvm-5df5a22d1a098961edebac59fbddcab045fddd29.tar.bz2
Add an assert so we don't silently miscompile ctpop for bit widths > 128.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123549 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 3a29424..477cf09 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -2389,6 +2389,7 @@ SDValue SelectionDAGLegalize::ExpandBSWAP(SDValue Op, DebugLoc dl) {
}
/// SplatByte - Distribute ByteVal over NumBits bits.
+// FIXME: Move this helper to a common place.
static APInt SplatByte(unsigned NumBits, uint8_t ByteVal) {
APInt Val = APInt(NumBits, ByteVal);
unsigned Shift = 8;
@@ -2410,6 +2411,9 @@ SDValue SelectionDAGLegalize::ExpandBitCount(unsigned Opc, SDValue Op,
EVT ShVT = TLI.getShiftAmountTy();
unsigned Len = VT.getSizeInBits();
+ assert(VT.isInteger() && Len <= 128 && Len % 8 == 0 &&
+ "CTPOP not implemented for this type.");
+
// This is the "best" algorithm from
// http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel