================
@@ -465,12 +465,48 @@ static cir::CIRCallOpInterface
 emitCallLikeOp(CIRGenFunction &cgf, mlir::Location callLoc,
                cir::FuncType indirectFuncTy, mlir::Value indirectFuncVal,
                cir::FuncOp directFuncOp,
-               const SmallVectorImpl<mlir::Value> &cirCallArgs,
+               const SmallVectorImpl<mlir::Value> &cirCallArgs, bool isInvoke,
                const mlir::NamedAttrList &attrs) {
   CIRGenBuilderTy &builder = cgf.getBuilder();
 
   assert(!cir::MissingFeatures::opCallSurroundingTry());
-  assert(!cir::MissingFeatures::invokeOp());
+
+  if (isInvoke) {
+    // This call can throw, few options:
+    //  - If this call does not have an associated cir.try, use the
+    //    one provided by InvokeDest,
+    //  - User written try/catch clauses require calls to handle
+    //    exceptions under cir.try.
----------------
andykaylor wrote:

This comment block seems somehow stale. In classic codegen, `InvokeDest` is a 
pointer to the basic block that is the unwind destination of the invoke 
instruction, and at [the time that this comment was 
written](https://github.com/llvm/clangir/commit/0430637465604548a9f569b2fb23da7a1fe1b863),
 `InvokeDest` was passed to this function as a pointer to an mlir operation, 
though as far as I can tell it was just a pointer to the try op.

Here's my best guess as to what the comment should say, based on the latest 
incubator implementation.

```suggestion
    // This call may throw and requires catch and/or cleanup handling.
    // If this call does not appear within the `try` region of an existing
    // TryOp, we must create a synthetic TryOp to contain the call. This
    // happens when a call that may throw appears within a cleanup
    // scope.
```

https://github.com/llvm/llvm-project/pull/165158
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to