@@ -285,9 +285,11 @@ def test_overlap(self):
285285 def test_predictions (self ):
286286 input = """
287287 inst(OP1, (arg -- res)) {
288+ DEAD(arg);
288289 res = Py_None;
289290 }
290291 inst(OP3, (arg -- res)) {
292+ DEAD(arg);
291293 DEOPT_IF(xxx);
292294 res = Py_None;
293295 }
@@ -303,7 +305,9 @@ def test_predictions(self):
303305 next_instr += 1;
304306 INSTRUCTION_STATS(OP1);
305307 PREDICTED_OP1:;
308+ _PyStackRef arg;
306309 _PyStackRef res;
310+ arg = stack_pointer[-1];
307311 res = Py_None;
308312 stack_pointer[-1] = res;
309313 DISPATCH();
@@ -320,7 +324,9 @@ def test_predictions(self):
320324 next_instr += 1;
321325 INSTRUCTION_STATS(OP3);
322326 static_assert(INLINE_CACHE_ENTRIES_OP1 == 0, "incorrect cache size");
327+ _PyStackRef arg;
323328 _PyStackRef res;
329+ arg = stack_pointer[-1];
324330 if (xxx) {
325331 UPDATE_MISS_STATS(OP1);
326332 assert(_PyOpcode_Deopt[opcode] == (OP1));
@@ -336,11 +342,13 @@ def test_predictions(self):
336342 def test_sync_sp (self ):
337343 input = """
338344 inst(A, (arg -- res)) {
345+ DEAD(arg);
339346 SYNC_SP();
340347 escaping_call();
341348 res = Py_None;
342349 }
343350 inst(B, (arg -- res)) {
351+ DEAD(arg);
344352 res = Py_None;
345353 SYNC_SP();
346354 escaping_call();
@@ -355,7 +363,9 @@ def test_sync_sp(self):
355363 frame->instr_ptr = next_instr;
356364 next_instr += 1;
357365 INSTRUCTION_STATS(A);
366+ _PyStackRef arg;
358367 _PyStackRef res;
368+ arg = stack_pointer[-1];
359369 stack_pointer += -1;
360370 assert(WITHIN_STACK_BOUNDS());
361371 _PyFrame_SetStackPointer(frame, stack_pointer);
@@ -376,7 +386,9 @@ def test_sync_sp(self):
376386 frame->instr_ptr = next_instr;
377387 next_instr += 1;
378388 INSTRUCTION_STATS(B);
389+ _PyStackRef arg;
379390 _PyStackRef res;
391+ arg = stack_pointer[-1];
380392 res = Py_None;
381393 stack_pointer[-1] = res;
382394 _PyFrame_SetStackPointer(frame, stack_pointer);
@@ -522,6 +534,7 @@ def test_error_if_pop_with_result(self):
522534 def test_cache_effect (self ):
523535 input = """
524536 inst(OP, (counter/1, extra/2, value --)) {
537+ DEAD(value);
525538 }
526539 """
527540 output = """
@@ -535,6 +548,8 @@ def test_cache_effect(self):
535548 frame->instr_ptr = next_instr;
536549 next_instr += 4;
537550 INSTRUCTION_STATS(OP);
551+ _PyStackRef value;
552+ value = stack_pointer[-1];
538553 uint16_t counter = read_u16(&this_instr[1].cache);
539554 (void)counter;
540555 uint32_t extra = read_u32(&this_instr[2].cache);
@@ -793,7 +808,9 @@ def test_array_input(self):
793808 input = """
794809 inst(OP, (below, values[oparg*2], above --)) {
795810 SPAM(values, oparg);
811+ DEAD(below);
796812 DEAD(values);
813+ DEAD(above);
797814 }
798815 """
799816 output = """
@@ -805,8 +822,12 @@ def test_array_input(self):
805822 frame->instr_ptr = next_instr;
806823 next_instr += 1;
807824 INSTRUCTION_STATS(OP);
825+ _PyStackRef below;
808826 _PyStackRef *values;
827+ _PyStackRef above;
828+ above = stack_pointer[-1];
809829 values = &stack_pointer[-1 - oparg*2];
830+ below = stack_pointer[-2 - oparg*2];
810831 SPAM(values, oparg);
811832 stack_pointer += -2 - oparg*2;
812833 assert(WITHIN_STACK_BOUNDS());
@@ -880,6 +901,8 @@ def test_array_input_output(self):
880901 def test_array_error_if (self ):
881902 input = """
882903 inst(OP, (extra, values[oparg] --)) {
904+ DEAD(extra);
905+ DEAD(values);
883906 ERROR_IF(oparg == 0, somewhere);
884907 }
885908 """
@@ -892,6 +915,10 @@ def test_array_error_if(self):
892915 frame->instr_ptr = next_instr;
893916 next_instr += 1;
894917 INSTRUCTION_STATS(OP);
918+ _PyStackRef extra;
919+ _PyStackRef *values;
920+ values = &stack_pointer[-oparg];
921+ extra = stack_pointer[-1 - oparg];
895922 if (oparg == 0) {
896923 stack_pointer += -1 - oparg;
897924 assert(WITHIN_STACK_BOUNDS());
@@ -1223,7 +1250,7 @@ def test_unused_used_used(self):
12231250 }
12241251 // THIRD
12251252 {
1226- y = x ;
1253+ y = stack_pointer[-1] ;
12271254 USE(y);
12281255 }
12291256 DISPATCH();
0 commit comments