@@ -148,36 +148,6 @@ def alias(
148148
149149@scf .dialect .register (key = "record" )
150150class LoopHandling (interp .MethodTable ):
151- """
152- @interp.impl(scf.stmts.For)
153- def for_loop_single_pass(
154- self, interp_: RecordAnalysis, frame: RecordFrame, stmt: scf.stmts.For
155- ):
156-
157- init_loop_vars = frame.get_values(stmt.initializers)
158-
159- loop_frame = RecordFrame(
160- stmt,
161- global_record_state=frame.global_record_state,
162- parent=frame,
163- has_parent_access=True,
164- )
165- loop_vars = interp_.frame_call_region(
166- loop_frame, stmt, stmt.body, InvalidRecord(), *init_loop_vars
167- )
168-
169- print(frame.global_record_state)
170-
171- if loop_vars is None:
172- return ()
173- elif isinstance(loop_vars, interp.ReturnValue):
174- return loop_vars
175-
176- # update the parent frame with the loop frame entries
177- frame.entries.update(loop_frame.entries)
178-
179- return loop_vars
180- """
181151
182152 @interp .impl (scf .stmts .For )
183153 def for_loop_double_pass (
@@ -186,9 +156,6 @@ def for_loop_double_pass(
186156
187157 init_loop_vars = frame .get_values (stmt .initializers )
188158
189- # for ssa_val, lattice_element in frame.entries.items():
190- # print(f"Before loop: {ssa_val} -> {lattice_element}")
191-
192159 # You go through the loops twice to verify the loop invariant.
193160 # we need to freeze the frame entries right after exiting the loop
194161
@@ -237,24 +204,11 @@ def for_loop_double_pass(
237204 # take the entries in the first and second loops
238205 # update the parent frame
239206
240- #
241- # debug prints
242- # print("First loop entries (captured + preserved):")
243- # stmt.body.print(analysis=captured_first_loop_entries)
244- # print("First loop entries (based off existing frame values):")
245- # stmt.body.print(analysis=first_loop_frame.entries)
246- # print("Second loop entries (via local state)")
247- # stmt.body.print(analysis=second_loop_frame.entries)
248- # print("local state after being passed through two loops")
249- # print(local_state)
250- # print(frame.global_record_state)
251- #
252207 unified_frame_buffer = {}
253208 for ssa_val , lattice_element in captured_first_loop_entries .items ():
254209 verified_latticed_element = second_loop_frame .entries [ssa_val ].join (
255210 lattice_element
256211 )
257- # print(f"Joining {lattice_element} and {second_loop_frame.entries[ssa_val]} to get {verified_latticed_element}")
258212 unified_frame_buffer [ssa_val ] = verified_latticed_element
259213
260214 frame .entries .update (unified_frame_buffer )
0 commit comments