aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2017-03-20 14:40:12 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2017-03-20 14:40:12 +0000
commit00b34996b49748045e2dd77e4f7ca60c258639e2 (patch)
treeda5c6c08879b6d2d2f1f2f8022248250ba4b9950 /llvm/lib/Analysis/ConstantFolding.cpp
parent195f23c53bb09d266b18c24519cf9bd0589972a0 (diff)
downloadllvm-00b34996b49748045e2dd77e4f7ca60c258639e2.zip
llvm-00b34996b49748045e2dd77e4f7ca60c258639e2.tar.gz
llvm-00b34996b49748045e2dd77e4f7ca60c258639e2.tar.bz2
Use MutableArrayRef for APFloat::convertToInteger
As discussed on D31074, use MutableArrayRef for destination integer buffers to help assert before stack overflows happen. llvm-svn: 298253
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 85ca622..e6939c0 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1518,9 +1518,9 @@ Constant *ConstantFoldSSEConvertToInt(const APFloat &Val, bool roundTowardZero,
bool isExact = false;
APFloat::roundingMode mode = roundTowardZero? APFloat::rmTowardZero
: APFloat::rmNearestTiesToEven;
- APFloat::opStatus status = Val.convertToInteger(&UIntVal, ResultWidth,
- /*isSigned=*/true, mode,
- &isExact);
+ APFloat::opStatus status =
+ Val.convertToInteger(makeMutableArrayRef(UIntVal), ResultWidth,
+ /*isSigned=*/true, mode, &isExact);
if (status != APFloat::opOK &&
(!roundTowardZero || status != APFloat::opInexact))
return nullptr;