[PATCH] D32116: [APInt] Remove self move check from move assignment operator
Hans Wennborg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 17 10:50:33 PDT 2017
hans added inline comments.
================
Comment at: include/llvm/ADT/APInt.h:681
/// @brief Move assignment operator.
APInt &operator=(APInt &&that) {
+ if (!isSingleWord())
----------------
Should we assert that this != &that ?
================
Comment at: include/llvm/ADT/APInt.h:689
- // If 'this == &that', avoid zeroing our own bitwidth by storing to 'that'
- // first.
- unsigned ThatBitWidth = that.BitWidth;
+ BitWidth = that.BitWidth;
that.BitWidth = 0;
----------------
Actually, couldn't we just memcpy/memove both VAL and BitWidth, i.e. the whole APInt? Don't know if that makes any difference though.
================
Comment at: include/llvm/ADT/APInt.h:690
+ BitWidth = that.BitWidth;
that.BitWidth = 0;
----------------
This isn't strictly necessary right, just for finding bugs? Maybe we should only do it for asserts builds?
https://reviews.llvm.org/D32116
More information about the llvm-commits
mailing list