llvm.org GIT mirror llvm / daacf22
Make the apint construction more effective. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35960 91177308-0d34-0410-b5e6-96231b3b80d8 Zhou Sheng 13 years ago
1 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
107107 /// ConstantRange.
108108 ///
109109 APInt ConstantRange::getSignedMax() const {
110 APInt SignedMax = APInt::getSignedMaxValue(getBitWidth());
110 APInt SignedMax(APInt::getSignedMaxValue(getBitWidth()));
111111 if (!isWrappedSet()) {
112112 if (getLower().slt(getUpper() - 1))
113113 return getUpper() - 1;
129129 /// ConstantRange.
130130 ///
131131 APInt ConstantRange::getSignedMin() const {
132 APInt SignedMin = APInt::getSignedMinValue(getBitWidth());
132 APInt SignedMin(APInt::getSignedMinValue(getBitWidth()));
133133 if (!isWrappedSet()) {
134134 if (getLower().slt(getUpper() - 1))
135135 return getLower();
369369 ConstantRange ConstantRange::truncate(uint32_t DstTySize) const {
370370 unsigned SrcTySize = getBitWidth();
371371 assert(SrcTySize > DstTySize && "Not a value truncation");
372 APInt Size = APInt::getMaxValue(DstTySize).zext(SrcTySize);
372 APInt Size(APInt::getLowBitsSet(SrcTySize, DstTySize));
373373 if (isFullSet() || getSetSize().ugt(Size))
374374 return ConstantRange(DstTySize);
375375