File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -179,7 +179,11 @@ def replace_opcode_if_evaluates_pure(
179179 emitter .emit ("if (\n " )
180180 assert isinstance (uop , Uop )
181181 input_identifiers = replace_opcode_if_evaluates_pure_identifiers (uop )
182- assert len (input_identifiers ) > 0 , "Pure operations must have at least 1 input"
182+ if len (input_identifiers ) == 0 :
183+ raise analysis_error (
184+ "Pure operations must have at least 1 input" ,
185+ self .original_uop .body .open
186+ )
183187 for inp in input_identifiers [:- 1 ]:
184188 emitter .emit (f"sym_is_safe_const(ctx, { inp } ) &&\n " )
185189 emitter .emit (f"sym_is_safe_const(ctx, { input_identifiers [- 1 ]} )\n " )
@@ -194,7 +198,11 @@ def replace_opcode_if_evaluates_pure(
194198 emitter .emit (f"{ stackref_type_name (inp )} { inp .name } = sym_get_const_as_stackref(ctx, { inp .name } _sym);\n " )
195199 # Rename all output variables to stackref variant.
196200 for outp in self .original_uop .stack .outputs :
197- assert not outp .is_array (), "Array output StackRefs not supported for pure ops."
201+ if outp .is_array ():
202+ raise analysis_error (
203+ "Array output StackRefs not supported for evaluating pure ops." ,
204+ self .original_uop .body .open
205+ )
198206 emitter .emit (f"_PyStackRef { outp .name } _stackref;\n " )
199207
200208
You can’t perform that action at this time.
0 commit comments