[clang] [llvm] [mlir] [OpenMP][OMPIRBuilder] Error propagation across callbacks (PR #112533)

Tom Eccles via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 17:41:55 PDT 2024


================
@@ -1496,7 +1507,8 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::createParallel(
   // Let the caller create the body.
   assert(BodyGenCB && "Expected body generation callback!");
   InsertPointTy CodeGenIP(PRegBodyBB, PRegBodyBB->begin());
-  BodyGenCB(InnerAllocaIP, CodeGenIP);
+  if (Error Err = BodyGenCB(InnerAllocaIP, CodeGenIP))
+    return std::move(Err);
----------------
tblah wrote:

I'm less sure about this case because it is constructing an `Expected<>` from the `Error`. It is more like
```
return Expected<OpenMPIRBuilder::InsertPointTy>{std::move(Err)};
```

I'm not sure if this `std::move` is a guaranteed compiler optimization in the same way as the above cases.

https://github.com/llvm/llvm-project/pull/112533


More information about the llvm-commits mailing list