<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Mar 20, 2017 at 7:52 AM Simon Pilgrim via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rksimon<br class="gmail_msg">
Date: Mon Mar 20 09:40:12 2017<br class="gmail_msg">
New Revision: 298253<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=298253&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=298253&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
Use MutableArrayRef for APFloat::convertToInteger<br class="gmail_msg">
<br class="gmail_msg">
As discussed on D31074, use MutableArrayRef for destination integer buffers to help assert before stack overflows happen.<br class="gmail_msg">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
llvm/trunk/include/llvm/ADT/APFloat.h<br class="gmail_msg">
llvm/trunk/include/llvm/ADT/ArrayRef.h<br class="gmail_msg">
llvm/trunk/lib/Analysis/ConstantFolding.cpp<br class="gmail_msg">
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp<br class="gmail_msg">
llvm/trunk/lib/Support/APFloat.cpp<br class="gmail_msg">
llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/include/llvm/ADT/APFloat.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=298253&r1=298252&r2=298253&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=298253&r1=298252&r2=298253&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/include/llvm/ADT/APFloat.h (original)<br class="gmail_msg">
+++ llvm/trunk/include/llvm/ADT/APFloat.h Mon Mar 20 09:40:12 2017<br class="gmail_msg">
@@ -18,6 +18,7 @@<br class="gmail_msg">
#define LLVM_ADT_APFLOAT_H<br class="gmail_msg">
<br class="gmail_msg">
#include "llvm/ADT/APInt.h"<br class="gmail_msg">
+#include "llvm/ADT/ArrayRef.h"<br class="gmail_msg">
#include "llvm/Support/ErrorHandling.h"<br class="gmail_msg">
#include <memory><br class="gmail_msg">
<br class="gmail_msg">
@@ -273,8 +274,8 @@ public:<br class="gmail_msg">
/// @{<br class="gmail_msg">
<br class="gmail_msg">
opStatus convert(const fltSemantics &, roundingMode, bool *);<br class="gmail_msg">
- opStatus convertToInteger(integerPart *, unsigned int, bool, roundingMode,<br class="gmail_msg">
- bool *) const;<br class="gmail_msg">
+ opStatus convertToInteger(MutableArrayRef<integerPart>, unsigned int, bool,<br class="gmail_msg">
+ roundingMode, bool *) const;<br class="gmail_msg">
opStatus convertFromAPInt(const APInt &, bool, roundingMode);<br class="gmail_msg">
opStatus convertFromSignExtendedInteger(const integerPart *, unsigned int,<br class="gmail_msg">
bool, roundingMode);<br class="gmail_msg">
@@ -495,8 +496,9 @@ private:<br class="gmail_msg">
opStatus addOrSubtract(const IEEEFloat &, roundingMode, bool subtract);<br class="gmail_msg">
opStatus handleOverflow(roundingMode);<br class="gmail_msg">
bool roundAwayFromZero(roundingMode, lostFraction, unsigned int) const;<br class="gmail_msg">
- opStatus convertToSignExtendedInteger(integerPart *, unsigned int, bool,<br class="gmail_msg">
- roundingMode, bool *) const;<br class="gmail_msg">
+ opStatus convertToSignExtendedInteger(MutableArrayRef<integerPart>,<br class="gmail_msg">
+ unsigned int, bool, roundingMode,<br class="gmail_msg">
+ bool *) const;<br class="gmail_msg">
opStatus convertFromUnsignedParts(const integerPart *, unsigned int,<br class="gmail_msg">
roundingMode);<br class="gmail_msg">
opStatus convertFromHexadecimalString(StringRef, roundingMode);<br class="gmail_msg">
@@ -625,8 +627,8 @@ public:<br class="gmail_msg">
opStatus convertFromString(StringRef, roundingMode);<br class="gmail_msg">
opStatus next(bool nextDown);<br class="gmail_msg">
<br class="gmail_msg">
- opStatus convertToInteger(integerPart *Input, unsigned int Width,<br class="gmail_msg">
- bool IsSigned, roundingMode RM,<br class="gmail_msg">
+ opStatus convertToInteger(MutableArrayRef<integerPart> Input,<br class="gmail_msg">
+ unsigned int Width, bool IsSigned, roundingMode RM,<br class="gmail_msg">
bool *IsExact) const;<br class="gmail_msg">
opStatus convertFromAPInt(const APInt &Input, bool IsSigned, roundingMode RM);<br class="gmail_msg">
opStatus convertFromSignExtendedInteger(const integerPart *Input,<br class="gmail_msg">
@@ -1055,8 +1057,8 @@ public:<br class="gmail_msg">
<br class="gmail_msg">
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM,<br class="gmail_msg">
bool *losesInfo);<br class="gmail_msg">
- opStatus convertToInteger(integerPart *Input, unsigned int Width,<br class="gmail_msg">
- bool IsSigned, roundingMode RM,<br class="gmail_msg">
+ opStatus convertToInteger(MutableArrayRef<integerPart> Input,<br class="gmail_msg">
+ unsigned int Width, bool IsSigned, roundingMode RM,<br class="gmail_msg">
bool *IsExact) const {<br class="gmail_msg">
APFLOAT_DISPATCH_ON_SEMANTICS(<br class="gmail_msg">
convertToInteger(Input, Width, IsSigned, RM, IsExact));<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=298253&r1=298252&r2=298253&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=298253&r1=298252&r2=298253&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/include/llvm/ADT/ArrayRef.h (original)<br class="gmail_msg">
+++ llvm/trunk/include/llvm/ADT/ArrayRef.h Mon Mar 20 09:40:12 2017<br class="gmail_msg">
@@ -487,6 +487,18 @@ namespace llvm {<br class="gmail_msg">
return ArrayRef<T>(Arr);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
+ /// Construct a MutableArrayRef from a single element.<br class="gmail_msg">
+ template<typename T><br class="gmail_msg">
+ MutableArrayRef<T> makeMutableArrayRef(T &OneElt) {<br class="gmail_msg">
+ return OneElt;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Construct a MutableArrayRef from a pointer and length.<br class="gmail_msg">
+ template<typename T><br class="gmail_msg">
+ MutableArrayRef<T> makeMutableArrayRef(T *data, size_t length) {<br class="gmail_msg">
+ return MutableArrayRef<T>(data, length);<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
/// @}<br class="gmail_msg">
/// @name ArrayRef Comparison Operators<br class="gmail_msg">
/// @{<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=298253&r1=298252&r2=298253&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=298253&r1=298252&r2=298253&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Mon Mar 20 09:40:12 2017<br class="gmail_msg">
@@ -1518,9 +1518,9 @@ Constant *ConstantFoldSSEConvertToInt(co<br class="gmail_msg">
bool isExact = false;<br class="gmail_msg">
APFloat::roundingMode mode = roundTowardZero? APFloat::rmTowardZero<br class="gmail_msg">
: APFloat::rmNearestTiesToEven;<br class="gmail_msg">
- APFloat::opStatus status = Val.convertToInteger(&UIntVal, ResultWidth,<br class="gmail_msg">
- /*isSigned=*/true, mode,<br class="gmail_msg">
- &isExact);<br class="gmail_msg">
+ APFloat::opStatus status =<br class="gmail_msg">
+ Val.convertToInteger(makeMutableArrayRef(UIntVal), </blockquote><div><br>MutableArrayRef has an implicit ctor from T& - do you need makeMutableArrayRef here rather than relying on the implicit conversion?<br><br>(similar question for other instances in this patch)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">ResultWidth,<br class="gmail_msg">
+ /*isSigned=*/true, mode, &isExact);<br class="gmail_msg">
if (status != APFloat::opOK &&<br class="gmail_msg">
(!roundTowardZero || status != APFloat::opInexact))<br class="gmail_msg">
return nullptr;<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=298253&r1=298252&r2=298253&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=298253&r1=298252&r2=298253&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Mon Mar 20 09:40:12 2017<br class="gmail_msg">
@@ -727,7 +727,7 @@ GenericValue ExecutionEngine::getConstan<br class="gmail_msg">
APFloat apf = APFloat(APFloat::x87DoubleExtended(), GV.IntVal);<br class="gmail_msg">
uint64_t v;<br class="gmail_msg">
bool ignored;<br class="gmail_msg">
- (void)apf.convertToInteger(&v, BitWidth,<br class="gmail_msg">
+ (void)apf.convertToInteger(makeMutableArrayRef(v), BitWidth,<br class="gmail_msg">
CE->getOpcode()==Instruction::FPToSI,<br class="gmail_msg">
APFloat::rmTowardZero, &ignored);<br class="gmail_msg">
GV.IntVal = v; // endian?<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Support/APFloat.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=298253&r1=298252&r2=298253&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=298253&r1=298252&r2=298253&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Support/APFloat.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Support/APFloat.cpp Mon Mar 20 09:40:12 2017<br class="gmail_msg">
@@ -1716,9 +1716,10 @@ IEEEFloat::opStatus IEEEFloat::remainder<br class="gmail_msg">
int parts = partCount();<br class="gmail_msg">
integerPart *x = new integerPart[parts];<br class="gmail_msg">
bool ignored;<br class="gmail_msg">
- fs = V.convertToInteger(x, parts * integerPartWidth, true,<br class="gmail_msg">
- rmNearestTiesToEven, &ignored);<br class="gmail_msg">
- if (fs==opInvalidOp) {<br class="gmail_msg">
+ fs = V.convertToInteger(makeMutableArrayRef(x, parts),<br class="gmail_msg">
+ parts * integerPartWidth, true, rmNearestTiesToEven,<br class="gmail_msg">
+ &ignored);<br class="gmail_msg">
+ if (fs == opInvalidOp) {<br class="gmail_msg">
delete[] x;<br class="gmail_msg">
return fs;<br class="gmail_msg">
}<br class="gmail_msg">
@@ -1756,9 +1757,10 @@ IEEEFloat::opStatus IEEEFloat::mod(const<br class="gmail_msg">
int parts = partCount();<br class="gmail_msg">
integerPart *x = new integerPart[parts];<br class="gmail_msg">
bool ignored;<br class="gmail_msg">
- fs = V.convertToInteger(x, parts * integerPartWidth, true,<br class="gmail_msg">
- rmTowardZero, &ignored);<br class="gmail_msg">
- if (fs==opInvalidOp) {<br class="gmail_msg">
+ fs = V.convertToInteger(makeMutableArrayRef(x, parts),<br class="gmail_msg">
+ parts * integerPartWidth, true, rmTowardZero,<br class="gmail_msg">
+ &ignored);<br class="gmail_msg">
+ if (fs == opInvalidOp) {<br class="gmail_msg">
delete[] x;<br class="gmail_msg">
return fs;<br class="gmail_msg">
}<br class="gmail_msg">
@@ -2051,7 +2053,7 @@ IEEEFloat::opStatus IEEEFloat::convert(c<br class="gmail_msg">
Note that for conversions to integer type the C standard requires<br class="gmail_msg">
round-to-zero to always be used. */<br class="gmail_msg">
IEEEFloat::opStatus IEEEFloat::convertToSignExtendedInteger(<br class="gmail_msg">
- integerPart *parts, unsigned int width, bool isSigned,<br class="gmail_msg">
+ MutableArrayRef<integerPart> parts, unsigned int width, bool isSigned,<br class="gmail_msg">
roundingMode rounding_mode, bool *isExact) const {<br class="gmail_msg">
lostFraction lost_fraction;<br class="gmail_msg">
const integerPart *src;<br class="gmail_msg">
@@ -2064,9 +2066,10 @@ IEEEFloat::opStatus IEEEFloat::convertTo<br class="gmail_msg">
return opInvalidOp;<br class="gmail_msg">
<br class="gmail_msg">
dstPartsCount = partCountForBits(width);<br class="gmail_msg">
+ assert(dstPartsCount <= parts.size() && "Integer too big");<br class="gmail_msg">
<br class="gmail_msg">
if (category == fcZero) {<br class="gmail_msg">
- APInt::tcSet(parts, 0, dstPartsCount);<br class="gmail_msg">
+ APInt::tcSet(parts.data(), 0, dstPartsCount);<br class="gmail_msg">
// Negative zero can't be represented as an int.<br class="gmail_msg">
*isExact = !sign;<br class="gmail_msg">
return opOK;<br class="gmail_msg">
@@ -2078,7 +2081,7 @@ IEEEFloat::opStatus IEEEFloat::convertTo<br class="gmail_msg">
the destination. */<br class="gmail_msg">
if (exponent < 0) {<br class="gmail_msg">
/* Our absolute value is less than one; truncate everything. */<br class="gmail_msg">
- APInt::tcSet(parts, 0, dstPartsCount);<br class="gmail_msg">
+ APInt::tcSet(parts.data(), 0, dstPartsCount);<br class="gmail_msg">
/* For exponent -1 the integer bit represents .5, look at that.<br class="gmail_msg">
For smaller exponents leftmost truncated bit is 0. */<br class="gmail_msg">
truncatedBits = semantics->precision -1U - exponent;<br class="gmail_msg">
@@ -2094,11 +2097,13 @@ IEEEFloat::opStatus IEEEFloat::convertTo<br class="gmail_msg">
if (bits < semantics->precision) {<br class="gmail_msg">
/* We truncate (semantics->precision - bits) bits. */<br class="gmail_msg">
truncatedBits = semantics->precision - bits;<br class="gmail_msg">
- APInt::tcExtract(parts, dstPartsCount, src, bits, truncatedBits);<br class="gmail_msg">
+ APInt::tcExtract(parts.data(), dstPartsCount, src, bits, truncatedBits);<br class="gmail_msg">
} else {<br class="gmail_msg">
/* We want at least as many bits as are available. */<br class="gmail_msg">
- APInt::tcExtract(parts, dstPartsCount, src, semantics->precision, 0);<br class="gmail_msg">
- APInt::tcShiftLeft(parts, dstPartsCount, bits - semantics->precision);<br class="gmail_msg">
+ APInt::tcExtract(parts.data(), dstPartsCount, src, semantics->precision,<br class="gmail_msg">
+ 0);<br class="gmail_msg">
+ APInt::tcShiftLeft(parts.data(), dstPartsCount,<br class="gmail_msg">
+ bits - semantics->precision);<br class="gmail_msg">
truncatedBits = 0;<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
@@ -2110,7 +2115,7 @@ IEEEFloat::opStatus IEEEFloat::convertTo<br class="gmail_msg">
truncatedBits);<br class="gmail_msg">
if (lost_fraction != lfExactlyZero &&<br class="gmail_msg">
roundAwayFromZero(rounding_mode, lost_fraction, truncatedBits)) {<br class="gmail_msg">
- if (APInt::tcIncrement(parts, dstPartsCount))<br class="gmail_msg">
+ if (APInt::tcIncrement(parts.data(), dstPartsCount))<br class="gmail_msg">
return opInvalidOp; /* Overflow. */<br class="gmail_msg">
}<br class="gmail_msg">
} else {<br class="gmail_msg">
@@ -2118,7 +2123,7 @@ IEEEFloat::opStatus IEEEFloat::convertTo<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
/* Step 3: check if we fit in the destination. */<br class="gmail_msg">
- unsigned int omsb = APInt::tcMSB(parts, dstPartsCount) + 1;<br class="gmail_msg">
+ unsigned int omsb = APInt::tcMSB(parts.data(), dstPartsCount) + 1;<br class="gmail_msg">
<br class="gmail_msg">
if (sign) {<br class="gmail_msg">
if (!isSigned) {<br class="gmail_msg">
@@ -2129,7 +2134,8 @@ IEEEFloat::opStatus IEEEFloat::convertTo<br class="gmail_msg">
/* It takes omsb bits to represent the unsigned integer value.<br class="gmail_msg">
We lose a bit for the sign, but care is needed as the<br class="gmail_msg">
maximally negative integer is a special case. */<br class="gmail_msg">
- if (omsb == width && APInt::tcLSB(parts, dstPartsCount) + 1 != omsb)<br class="gmail_msg">
+ if (omsb == width &&<br class="gmail_msg">
+ APInt::tcLSB(parts.data(), dstPartsCount) + 1 != omsb)<br class="gmail_msg">
return opInvalidOp;<br class="gmail_msg">
<br class="gmail_msg">
/* This case can happen because of rounding. */<br class="gmail_msg">
@@ -2137,7 +2143,7 @@ IEEEFloat::opStatus IEEEFloat::convertTo<br class="gmail_msg">
return opInvalidOp;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
- APInt::tcNegate (parts, dstPartsCount);<br class="gmail_msg">
+ APInt::tcNegate (parts.data(), dstPartsCount);<br class="gmail_msg">
} else {<br class="gmail_msg">
if (omsb >= width + !isSigned)<br class="gmail_msg">
return opInvalidOp;<br class="gmail_msg">
@@ -2159,11 +2165,10 @@ IEEEFloat::opStatus IEEEFloat::convertTo<br class="gmail_msg">
the original value. This is almost equivalent to result==opOK,<br class="gmail_msg">
except for negative zeroes.<br class="gmail_msg">
*/<br class="gmail_msg">
-IEEEFloat::opStatus IEEEFloat::convertToInteger(integerPart *parts,<br class="gmail_msg">
- unsigned int width,<br class="gmail_msg">
- bool isSigned,<br class="gmail_msg">
- roundingMode rounding_mode,<br class="gmail_msg">
- bool *isExact) const {<br class="gmail_msg">
+IEEEFloat::opStatus<br class="gmail_msg">
+IEEEFloat::convertToInteger(MutableArrayRef<integerPart> parts,<br class="gmail_msg">
+ unsigned int width, bool isSigned,<br class="gmail_msg">
+ roundingMode rounding_mode, bool *isExact) const {<br class="gmail_msg">
opStatus fs;<br class="gmail_msg">
<br class="gmail_msg">
fs = convertToSignExtendedInteger(parts, width, isSigned, rounding_mode,<br class="gmail_msg">
@@ -2173,6 +2178,7 @@ IEEEFloat::opStatus IEEEFloat::convertTo<br class="gmail_msg">
unsigned int bits, dstPartsCount;<br class="gmail_msg">
<br class="gmail_msg">
dstPartsCount = partCountForBits(width);<br class="gmail_msg">
+ assert(dstPartsCount <= parts.size() && "Integer too big");<br class="gmail_msg">
<br class="gmail_msg">
if (category == fcNaN)<br class="gmail_msg">
bits = 0;<br class="gmail_msg">
@@ -2181,9 +2187,9 @@ IEEEFloat::opStatus IEEEFloat::convertTo<br class="gmail_msg">
else<br class="gmail_msg">
bits = width - isSigned;<br class="gmail_msg">
<br class="gmail_msg">
- APInt::tcSetLeastSignificantBits(parts, dstPartsCount, bits);<br class="gmail_msg">
+ APInt::tcSetLeastSignificantBits(parts.data(), dstPartsCount, bits);<br class="gmail_msg">
if (sign && isSigned)<br class="gmail_msg">
- APInt::tcShiftLeft(parts, dstPartsCount, width - 1);<br class="gmail_msg">
+ APInt::tcShiftLeft(parts.data(), dstPartsCount, width - 1);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
return fs;<br class="gmail_msg">
@@ -4293,11 +4299,10 @@ APFloat::opStatus DoubleAPFloat::next(bo<br class="gmail_msg">
return Ret;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
-APFloat::opStatus DoubleAPFloat::convertToInteger(integerPart *Input,<br class="gmail_msg">
- unsigned int Width,<br class="gmail_msg">
- bool IsSigned,<br class="gmail_msg">
- roundingMode RM,<br class="gmail_msg">
- bool *IsExact) const {<br class="gmail_msg">
+APFloat::opStatus<br class="gmail_msg">
+DoubleAPFloat::convertToInteger(MutableArrayRef<integerPart> Input,<br class="gmail_msg">
+ unsigned int Width, bool IsSigned,<br class="gmail_msg">
+ roundingMode RM, bool *IsExact) const {<br class="gmail_msg">
assert(Semantics == &semPPCDoubleDouble && "Unexpected Semantics");<br class="gmail_msg">
return APFloat(semPPCDoubleDoubleLegacy, bitcastToAPInt())<br class="gmail_msg">
.convertToInteger(Input, Width, IsSigned, RM, IsExact);<br class="gmail_msg">
@@ -4511,7 +4516,7 @@ APFloat::opStatus APFloat::convertToInte<br class="gmail_msg">
bool *isExact) const {<br class="gmail_msg">
unsigned bitWidth = result.getBitWidth();<br class="gmail_msg">
SmallVector<uint64_t, 4> parts(result.getNumWords());<br class="gmail_msg">
- opStatus status = convertToInteger(parts.data(), bitWidth, result.isSigned(),<br class="gmail_msg">
+ opStatus status = convertToInteger(parts, bitWidth, result.isSigned(),<br class="gmail_msg">
rounding_mode, isExact);<br class="gmail_msg">
// Keeps the original signed-ness.<br class="gmail_msg">
result = APInt(bitWidth, parts);<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=298253&r1=298252&r2=298253&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=298253&r1=298252&r2=298253&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Mar 20 09:40:12 2017<br class="gmail_msg">
@@ -231,8 +231,9 @@ static bool ConvertToSInt(const APFloat<br class="gmail_msg">
bool isExact = false;<br class="gmail_msg">
// See if we can convert this to an int64_t<br class="gmail_msg">
uint64_t UIntVal;<br class="gmail_msg">
- if (APF.convertToInteger(&UIntVal, 64, true, APFloat::rmTowardZero,<br class="gmail_msg">
- &isExact) != APFloat::opOK || !isExact)<br class="gmail_msg">
+ if (APF.convertToInteger(makeMutableArrayRef(UIntVal), 64, true,<br class="gmail_msg">
+ APFloat::rmTowardZero, &isExact) != APFloat::opOK ||<br class="gmail_msg">
+ !isExact)<br class="gmail_msg">
return false;<br class="gmail_msg">
IntVal = UIntVal;<br class="gmail_msg">
return true;<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
llvm-commits mailing list<br class="gmail_msg">
<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div></div>