[PATCH] D50999: [APFloat] Remove dead store in the move constructor of IEEEFloat
Victor Gao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 20 15:01:52 PDT 2018
vgao updated this revision to Diff 161573.
vgao added a comment.
fix path
Repository:
rL LLVM
https://reviews.llvm.org/D50999
Files:
llvm/trunk/include/llvm/ADT/APFloat.h
llvm/trunk/lib/Support/APFloat.cpp
Index: llvm/trunk/lib/Support/APFloat.cpp
===================================================================
--- llvm/trunk/lib/Support/APFloat.cpp
+++ llvm/trunk/lib/Support/APFloat.cpp
@@ -744,9 +744,7 @@
return *this;
}
-IEEEFloat &IEEEFloat::operator=(IEEEFloat &&rhs) {
- freeSignificand();
-
+void IEEEFloat::moveFields(IEEEFloat &&rhs) {
semantics = rhs.semantics;
significand = rhs.significand;
exponent = rhs.exponent;
@@ -754,6 +752,11 @@
sign = rhs.sign;
rhs.semantics = &semBogus;
+}
+
+IEEEFloat &IEEEFloat::operator=(IEEEFloat &&rhs) {
+ freeSignificand();
+ moveFields(std::move(rhs));
return *this;
}
@@ -873,9 +876,7 @@
assign(rhs);
}
-IEEEFloat::IEEEFloat(IEEEFloat &&rhs) : semantics(&semBogus) {
- *this = std::move(rhs);
-}
+IEEEFloat::IEEEFloat(IEEEFloat &&rhs) { moveFields(std::move(rhs)); }
IEEEFloat::~IEEEFloat() { freeSignificand(); }
Index: llvm/trunk/include/llvm/ADT/APFloat.h
===================================================================
--- llvm/trunk/include/llvm/ADT/APFloat.h
+++ llvm/trunk/include/llvm/ADT/APFloat.h
@@ -537,6 +537,8 @@
void copySignificand(const IEEEFloat &);
void freeSignificand();
+ void moveFields(IEEEFloat &&);
+
/// Note: this must be the first data member.
/// The semantics that this value obeys.
const fltSemantics *semantics;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50999.161573.patch
Type: text/x-patch
Size: 1361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180820/b9d6027a/attachment.bin>
More information about the llvm-commits
mailing list