================
@@ -6410,9 +6410,11 @@ class SpirvOperand {
   ~SpirvOperand() {}
 
   SpirvOperand &operator=(const SpirvOperand &Other) {
-    this->Kind = Other.Kind;
-    this->ResultType = Other.ResultType;
-    this->Value = Other.Value;
+    if (this != &Other) {
----------------
erichkeane wrote:

For comparison yes.  Sorry, my suggestion was for THIS, not for `operator==` 
(though TBH, I expected you to try both and tell my why it wouldn't work, and I 
hadn't recalled that we only added it for compare then :) ).  

But `operator=` should work with just `= default`.

My problem with the guard is how inexpensive the copy is (though I see 
`llvm::APInt` doesn't actually support self-move-assign, but DOES have the 
`this = &RHS` for copy) compared to a branch.

So `=default` would 'get it right'.



https://github.com/llvm/llvm-project/pull/145743
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to