[all-commits] [llvm/llvm-project] b6cd21: [CIR] Simplify try-catch handling (#180857)

Andy Kaylor via All-commits all-commits at lists.llvm.org
Fri Feb 13 10:41:16 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b6cd2133d49c8b5e8375241cc2c101a1f1e960f8
      https://github.com/llvm/llvm-project/commit/b6cd2133d49c8b5e8375241cc2c101a1f1e960f8
  Author: Andy Kaylor <akaylor at nvidia.com>
  Date:   2026-02-13 (Fri, 13 Feb 2026)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenCall.cpp
    M clang/lib/CIR/CodeGen/CIRGenCleanup.cpp
    M clang/lib/CIR/CodeGen/CIRGenCleanup.h
    M clang/lib/CIR/CodeGen/CIRGenException.cpp
    M clang/lib/CIR/CodeGen/CIRGenFunction.h
    M clang/lib/CIR/CodeGen/EHScopeStack.h
    M clang/test/CIR/CodeGen/try-catch.cpp

  Log Message:
  -----------
  [CIR] Simplify try-catch handling (#180857)

With the new exception handling device, we no longer need to track the
location of potential catch blocks, and so we no longer need to
represent catch handlers on the EH stack. This allows us to
significantly simplify the generation of try-catch blocks.

This change emits catch blocks directly when visiting the try operation
and removes unnecessary EH management code.

This is not an exhaustive cleanup of the EH management code. Some things
that may appear to be obvious simplifications (such as removing the
union of bitfields in EHScope, and possibly making EHScopeStack just a
stack of EHCleanups) are deferred until we have a better idea of how
things like EH filters will be implemented.

This change breaks lowering of cir.try operations to LLVM IR in a
somewhat trivial way. Even before this PR, lowering of `cir.try` ops
with catch handlers was not implemented. However, we had one test case
where the only call in a try-region was marked with the `noexcept`
attribute. Previously, we did not emit catch handlers in that
circumstance. Now we do. As such, nothing that previously worked is
broken by this patch, but there is one test that would now fail. I
handled this by removing the RUN line for lowering this test to LLVM IR.
I left the checks so this will be easy to re-enable when proper try-op
lowering is implemented.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list