llvm-c166/mlir/python
Twice a4402bd0cc
[MLIR][Python] Add effect and speculatability specifiers for Python-defined ops (#216773)
This PR adds standalone effect and speculatability specifiers for
Python-defined operations.

`NoMemoryEffect` and `AlwaysSpeculatable`, previously nested under
`Pure`, are now public, and `RecursivelySpeculatable` is added. `Pure`
remains a shorthand for attaching `NoMemoryEffect` and
`AlwaysSpeculatable`.

This also exposes `OpTrait::HasRecursiveMemoryEffects` through the C API
and Python bindings as `ir.RecursiveMemoryEffectsTrait`, allowing
region-bearing Python-defined operations to derive their memory effects
from nested operations:

```python
class LeafOp(
    TestDialect.Operation,
    name="leaf",
    traits=[NoMemoryEffect, AlwaysSpeculatable],
):
    pass


class RegionOp(
    TestDialect.Operation,
    name="region",
    traits=[
        ir.NoTerminatorTrait,
        ir.RecursiveMemoryEffectsTrait,
        RecursivelySpeculatable,
    ],
):
    body: Region
```

Tests cover direct interface queries and validate recursive memory
effects with CSE and trivial DCE.

Related to #177735 and #195505.

Assisted-by: Codex / GPT-5.6 Sol
2026-08-23 00:27:37 +08:00
..
mlir [MLIR][Python] Add effect and speculatability specifiers for Python-defined ops (#216773) 2026-08-23 00:27:37 +08:00
CMakeLists.txt [MLIR][Python] Drop the LLVMSupport link dependency from the python extensions (#213509) 2026-08-02 07:08:06 +00:00
requirements.txt