[PATCH] D78425: [ValueLattice] Add move constructor

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 07:33:00 PDT 2020


nikic marked 2 inline comments as done.
nikic added inline comments.


================
Comment at: include/llvm/Analysis/ValueLattice.h:129
-        !Other.isNotConstant())
-      ConstVal = nullptr;
-
----------------
Happy to commit this part separately: This nulling of ConstVal looks unnecessary to me. `ConstVal` is not an owned pointer, so this doesn't free it. If we change to a state that does not the ConstVal, then the value simply does not matter and we can leave it alone.


================
Comment at: include/llvm/Analysis/ValueLattice.h:153
+    if (isConstantRange())
+      Range.~ConstantRange();
+
----------------
I went for a slightly simpler implementation than the copy assignment operator here by always destroying and constructing, rather than trying to do an assignment if we go from one range to another range. That makes (theoretical, but probably not practical) sense for copy assignment, but not for move assignment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78425/new/

https://reviews.llvm.org/D78425





More information about the llvm-commits mailing list