diff options
author | Twice <twice@apache.org> | 2025-09-09 23:05:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-09 08:05:39 -0700 |
commit | 7123463ef98bd478ff068dc94bfeee1b13c551c3 (patch) | |
tree | 546408ac9d65bb511525370cd2f3f7f38941afe0 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 406d6bd153a69a132f24363702cd116d0edcdb50 (diff) | |
download | llvm-7123463ef98bd478ff068dc94bfeee1b13c551c3.zip llvm-7123463ef98bd478ff068dc94bfeee1b13c551c3.tar.gz llvm-7123463ef98bd478ff068dc94bfeee1b13c551c3.tar.bz2 |
[MLIR][Python] Add the ability to signal pass failures in python-defined passes (#157613)
This is a follow-up PR for #156000.
In this PR we add the ability to signal pass failures
(`signal_pass_failure()`) in python-defined passes.
To achieve this, we expose `MlirExternalPass` via `nb::class_` with a
method `signal_pass_failure()`, and the callable passed to `pm.add(..)`
now accepts two arguments (`op: MlirOperation, pass_:
MlirExternalPass`).
For example:
```python
def custom_pass_that_fails(op, pass_):
if some_condition:
pass_.signal_pass_failure()
# do something
```
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions