[clang] [CIR] Fix try_call replacement for indirect calls (PR #185095)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 6 13:12:15 PST 2026


================
@@ -648,12 +648,22 @@ static void replaceCallWithTryCall(cir::CallOp callOp, mlir::Block *unwindDest,
 
   // Build the try_call to replace the original call.
   rewriter.setInsertionPoint(callOp);
-  mlir::Type resType = callOp->getNumResults() > 0
-                           ? callOp->getResult(0).getType()
-                           : mlir::Type();
-  auto tryCallOp =
-      cir::TryCallOp::create(rewriter, loc, callOp.getCalleeAttr(), resType,
-                             normalDest, unwindDest, callOp.getArgOperands());
+  cir::TryCallOp tryCallOp;
+  if (callOp.isIndirect()) {
----------------
andykaylor wrote:

Yeah. I remembered after I posted this PR that you had mentioned that we were dropping attributes here. I'd like to fix that in a separate change, but I'll add a TODO comment now.

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


More information about the cfe-commits mailing list