[clang] [CIR] Upstream TryCallOp (PR #165303)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 25 14:47:39 PST 2025


================
@@ -0,0 +1,31 @@
+// RUN: cir-opt %s --verify-roundtrip | FileCheck %s
+
+!s32i = !cir.int<s, 32>
+
+module {
+
+cir.func private @division(%a: !s32i, %b: !s32i) -> !s32i
+
+cir.func @flatten_structure_with_try_call_op() {
+   %a = cir.const #cir.int<1> : !s32i
+   %b = cir.const #cir.int<2> : !s32i
+   %3 = cir.try_call @division(%a, %b) ^continue, ^landing_pad : (!s32i, !s32i) -> !s32i
+ ^continue:
+   cir.br ^landing_pad
+ ^landing_pad:
----------------
andykaylor wrote:

```suggestion
   %3 = cir.try_call @division(%a, %b) ^normalDest, ^unwindDest : (!s32i, !s32i) -> !s32i
 ^normalDest:
   cir.br ^end
 ^unwindDest:
   cir.br ^end
  ^end
```
I'm suggesting that the names here should align with the op description, but also it doesn't make sense for the normal destination to branch to the landing pad, although I guess after optimization that could happen in some trivial cases.

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


More information about the cfe-commits mailing list