File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
integration_test/Bindings/Python Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ # REQUIRES: bindings_python
2+ # RUN: %PYTHON% %s
3+
4+ import circt
5+ from circt import ir
6+ from circt .dialects import arith
7+
8+ # Ensure that the `OpOperand`s returned as the `uses` list of a value have a
9+ # concrete subclass of `OpView`, not just `OpView` itself. This was a regression
10+ # that happened upstream, where you could no longer use
11+ # `isinstance(use.owner, AddIOp)` to check whether a user of a value is a
12+ # specific op.
13+ with ir .Context () as ctx , ir .Location .unknown () as loc :
14+ circt .register_dialects (ctx )
15+ module = ir .Module .parse ("""
16+ %0 = arith.constant 0 : i8
17+ %1 = arith.addi %0, %0 : i8
18+ """ )
19+ zero , add = list (module .body )
20+ use = list (zero .result .uses )[0 ]
21+ assert use .owner == add
22+ assert isinstance (add , arith .AddIOp )
23+ assert isinstance (use .owner , arith .AddIOp )
You can’t perform that action at this time.
0 commit comments