aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authordjg <djg@91177308-0d34-0410-b5e6-96231b3b80d8>2009-01-27 20:39:34 +0000
committerdjg <djg@91177308-0d34-0410-b5e6-96231b3b80d8>2009-01-27 20:39:34 +0000
commit51bef2e7f3b8bd4bafc8b4e4e6d42d0b2ede47ee (patch)
treea60dd3cbe68329a1fa1e55da165597ddfeecc67c /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parentd23c21b8077433159dc4dc728eb91e0eba8f0436 (diff)
downloadexternal_llvm-51bef2e7f3b8bd4bafc8b4e4e6d42d0b2ede47ee.zip
external_llvm-51bef2e7f3b8bd4bafc8b4e4e6d42d0b2ede47ee.tar.gz
external_llvm-51bef2e7f3b8bd4bafc8b4e4e6d42d0b2ede47ee.tar.bz2
Add an assertion to the form of SelectionDAG::getConstant that takes
a uint64_t to verify that the value is in range for the given type, to help catch accidental overflow. Fix a few places that relied on getConstant implicitly truncating the value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63128 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 723c512..58ac8c2 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -6293,7 +6293,7 @@ SDValue SelectionDAGLegalize::ExpandBitCount(unsigned Opc, SDValue Op) {
unsigned len = VT.getSizeInBits();
for (unsigned i = 0; (1U << i) <= (len / 2); ++i) {
//x = (x & mask[i][len/8]) + (x >> (1 << i) & mask[i][len/8])
- SDValue Tmp2 = DAG.getConstant(mask[i], VT);
+ SDValue Tmp2 = DAG.getConstant(VT.getIntegerVTBitMask() & mask[i], VT);
SDValue Tmp3 = DAG.getConstant(1ULL << i, ShVT);
Op = DAG.getNode(ISD::ADD, VT, DAG.getNode(ISD::AND, VT, Op, Tmp2),
DAG.getNode(ISD::AND, VT,