================
@@ -1171,12 +1179,15 @@ void OpenMPIRBuilder::emitCancelationCheckImpl(Value 
*CancelFlag,
   // post finalization block that is known to the FiniCB callback.
   Builder.SetInsertPoint(CancellationBlock);
   if (ExitCB)
-    ExitCB(Builder.saveIP());
+    if (Error Err = ExitCB(Builder.saveIP()))
+      return std::move(Err);
----------------
tblah wrote:

nit: the compiler should automatically move from a returned value whether you 
specify `std::move` or not (guaranteed from C++17 onwards). In general it is 
unhelpful to add the `std::move` here because it can prevent the return from 
being optimized out entirely.
```suggestion
      return Err;
```

See 
https://stackoverflow.com/questions/17473753/c11-return-value-optimization-or-move
 and 
https://stackoverflow.com/questions/14856344/when-should-stdmove-be-used-on-a-function-return-value

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

Reply via email to