diff options
author | Duncan Sands <baldrick@free.fr> | 2009-02-01 18:06:53 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-02-01 18:06:53 +0000 |
commit | 505ba94e7557c4396dcbcd3ca8ec3d37fc280958 (patch) | |
tree | 7a0189db8f4dd16bcf86da71718afa2515dd3e19 /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | 55b2b9d20c04019c67efeb9fcc7045b11f8e23b3 (diff) | |
download | external_llvm-505ba94e7557c4396dcbcd3ca8ec3d37fc280958.zip external_llvm-505ba94e7557c4396dcbcd3ca8ec3d37fc280958.tar.gz external_llvm-505ba94e7557c4396dcbcd3ca8ec3d37fc280958.tar.bz2 |
Fix PR3453 and probably a bunch of other potential
crashes or wrong code with codegen of large integers:
eliminate the legacy getIntegerVTBitMask and
getIntegerVTSignBit methods, which returned their
value as a uint64_t, so couldn't handle huge types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63494 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 4dd5dd2..0b3d979 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -3110,9 +3110,9 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) { DAG.getNode(ISD::EXTRACT_VECTOR_ELT, TmpEltVT, Tmp2, DAG.getIntPtrConstant(i)), CC); - Ops[i] = DAG.getNode(ISD::SELECT, EltVT, Ops[i], - DAG.getConstant(EltVT.getIntegerVTBitMask(),EltVT), - DAG.getConstant(0, EltVT)); + Ops[i] = DAG.getNode(ISD::SELECT, EltVT, Ops[i], DAG.getConstant( + APInt::getAllOnesValue(EltVT.getSizeInBits()), + EltVT), DAG.getConstant(0, EltVT)); } Result = DAG.getNode(ISD::BUILD_VECTOR, VT, &Ops[0], NumElems); break; @@ -6291,7 +6291,9 @@ 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(VT.getIntegerVTBitMask() & mask[i], VT); + unsigned EltSize = VT.isVector() ? + VT.getVectorElementType().getSizeInBits() : len; + SDValue Tmp2 = DAG.getConstant(APInt(EltSize, 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, |