[all-commits] [llvm/llvm-project] d0676f: [CIR] Handle throwing an exception from a cleanup ...
Andy Kaylor via All-commits
all-commits at lists.llvm.org
Wed May 27 11:06:57 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d0676f53ed5b56a1f077fe8a4587ecb10e5400ee
https://github.com/llvm/llvm-project/commit/d0676f53ed5b56a1f077fe8a4587ecb10e5400ee
Author: Andy Kaylor <akaylor at nvidia.com>
Date: 2026-05-27 (Wed, 27 May 2026)
Changed paths:
M clang/include/clang/CIR/Dialect/IR/CIROps.td
M clang/include/clang/CIR/Dialect/Transforms/CIRTransformUtils.h
M clang/lib/CIR/Dialect/IR/CIRDialect.cpp
M clang/lib/CIR/Dialect/Transforms/CIRTransformUtils.cpp
M clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp
M clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp
A clang/test/CIR/CodeGen/cleanup-throw-from-cleanup.cpp
M clang/test/CIR/CodeGen/try-catch.cpp
Log Message:
-----------
[CIR] Handle throwing an exception from a cleanup scope (#199121)
The CIR FlattenCFG pass had been ignoring any ThrowOp that occurred
inside a cleanup scope or try operation, which led to the thrown
exception not triggering local cleanups and bypassing local catch
handlers.
This change introduces a new CIR operation, TryThrowOp, which is
analagous to the existing TryCallOp. The TryThrowOp (as well as the
ThrowOp) will eventually be lowered to a function call, but which
function gets called is a target-dependent detail, so we need an
abstract operation before EHABI lowering.
The Flatten CFG pass replaces any ThrowOp inside a cleanup scope or try
operation with a TryThrowOp that has an unreachable normal destination
and unwinds to the appropriate cleanup or catch dispatch block.
Assisted-by: Cursor / claude-opus-4.7-thinking-xhigh
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