File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
test/analysis/dataflow/constprop Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -73,11 +73,10 @@ def frame_eval(
7373 if types .is_tuple_of (values , Value ):
7474 return self .try_eval_const_pure (frame , node , values )
7575
76- if node .has_trait (ir .Pure ):
77- return (Unknown (),) # no implementation but pure
78- # not pure, and no implementation, let's say it's not pure
79- frame .frame_is_not_pure = True
80- return (Unknown (),)
76+ if not node .has_trait (ir .Pure ):
77+ # not pure, and no implementation, let's say it's not pure
78+ frame .frame_is_not_pure = True
79+ return tuple (Unknown () for _ in node ._results )
8180
8281 ret = method (self , frame , node )
8382 if node .has_trait (ir .IsTerminator ) or node .has_trait (ir .Pure ):
Original file line number Diff line number Diff line change @@ -21,6 +21,19 @@ def __init__(self, *args: ir.SSAValue):
2121 )
2222
2323
24+ @statement (dialect = dialect )
25+ class MultiReturnNotPure (ir .Statement ):
26+ traits = frozenset ({lowering .FromPythonCall ()})
27+ inputs : tuple [ir .SSAValue ] = info .argument (types .Any )
28+
29+ def __init__ (self , * args : ir .SSAValue ):
30+ super ().__init__ (
31+ args = args ,
32+ result_types = tuple (arg .type for arg in args ),
33+ args_slice = {"inputs" : slice (None )},
34+ )
35+
36+
2437@ir .dialect_group (structural_no_opt .add (dialect ))
2538def dialect_group_test (self ):
2639 fold = Fold (self )
@@ -40,6 +53,7 @@ def test_multi_return_default_prop():
4053 (b := py .Constant (2 )),
4154 (res := MultiReturnStatement (a .result , b .result )),
4255 (return_result := ilist .New ((res .results [0 ], res .results [1 ]))),
56+ (res := MultiReturnNotPure (a .result , b .result )),
4357 (func .Return (return_result .result )),
4458 ]
4559
You can’t perform that action at this time.
0 commit comments