mirror of
https://github.com/siemens-mobile-hacks/llvm-c166.git
synced 2026-11-25 21:45:57 +00:00
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
|
||
|---|---|---|
| .. | ||
| mlir | ||
| CMakeLists.txt | ||
| requirements.txt | ||