diff options
author | Dan Gohman <gohman@apple.com> | 2009-01-27 20:39:34 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-01-27 20:39:34 +0000 |
commit | fb58faf29e10a4f798f661a317ed5f0992284842 (patch) | |
tree | 215efc63ed808aaaf10c541aa2a08d0b517e22b7 /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | 570c357ded427b55c35ddfe4b5ff73e221ea1305 (diff) | |
download | bcm5719-llvm-fb58faf29e10a4f798f661a317ed5f0992284842.tar.gz bcm5719-llvm-fb58faf29e10a4f798f661a317ed5f0992284842.zip |
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.
llvm-svn: 63128
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 723c512c92e..58ac8c285c9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/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, |