@@ -285,9 +285,11 @@ def test_overlap(self):
285
285
def test_predictions (self ):
286
286
input = """
287
287
inst(OP1, (arg -- res)) {
288
+ DEAD(arg);
288
289
res = Py_None;
289
290
}
290
291
inst(OP3, (arg -- res)) {
292
+ DEAD(arg);
291
293
DEOPT_IF(xxx);
292
294
res = Py_None;
293
295
}
@@ -303,7 +305,9 @@ def test_predictions(self):
303
305
next_instr += 1;
304
306
INSTRUCTION_STATS(OP1);
305
307
PREDICTED_OP1:;
308
+ _PyStackRef arg;
306
309
_PyStackRef res;
310
+ arg = stack_pointer[-1];
307
311
res = Py_None;
308
312
stack_pointer[-1] = res;
309
313
DISPATCH();
@@ -320,7 +324,9 @@ def test_predictions(self):
320
324
next_instr += 1;
321
325
INSTRUCTION_STATS(OP3);
322
326
static_assert(INLINE_CACHE_ENTRIES_OP1 == 0, "incorrect cache size");
327
+ _PyStackRef arg;
323
328
_PyStackRef res;
329
+ arg = stack_pointer[-1];
324
330
if (xxx) {
325
331
UPDATE_MISS_STATS(OP1);
326
332
assert(_PyOpcode_Deopt[opcode] == (OP1));
@@ -336,11 +342,13 @@ def test_predictions(self):
336
342
def test_sync_sp (self ):
337
343
input = """
338
344
inst(A, (arg -- res)) {
345
+ DEAD(arg);
339
346
SYNC_SP();
340
347
escaping_call();
341
348
res = Py_None;
342
349
}
343
350
inst(B, (arg -- res)) {
351
+ DEAD(arg);
344
352
res = Py_None;
345
353
SYNC_SP();
346
354
escaping_call();
@@ -355,7 +363,9 @@ def test_sync_sp(self):
355
363
frame->instr_ptr = next_instr;
356
364
next_instr += 1;
357
365
INSTRUCTION_STATS(A);
366
+ _PyStackRef arg;
358
367
_PyStackRef res;
368
+ arg = stack_pointer[-1];
359
369
stack_pointer += -1;
360
370
assert(WITHIN_STACK_BOUNDS());
361
371
_PyFrame_SetStackPointer(frame, stack_pointer);
@@ -376,7 +386,9 @@ def test_sync_sp(self):
376
386
frame->instr_ptr = next_instr;
377
387
next_instr += 1;
378
388
INSTRUCTION_STATS(B);
389
+ _PyStackRef arg;
379
390
_PyStackRef res;
391
+ arg = stack_pointer[-1];
380
392
res = Py_None;
381
393
stack_pointer[-1] = res;
382
394
_PyFrame_SetStackPointer(frame, stack_pointer);
@@ -522,6 +534,7 @@ def test_error_if_pop_with_result(self):
522
534
def test_cache_effect (self ):
523
535
input = """
524
536
inst(OP, (counter/1, extra/2, value --)) {
537
+ DEAD(value);
525
538
}
526
539
"""
527
540
output = """
@@ -535,6 +548,8 @@ def test_cache_effect(self):
535
548
frame->instr_ptr = next_instr;
536
549
next_instr += 4;
537
550
INSTRUCTION_STATS(OP);
551
+ _PyStackRef value;
552
+ value = stack_pointer[-1];
538
553
uint16_t counter = read_u16(&this_instr[1].cache);
539
554
(void)counter;
540
555
uint32_t extra = read_u32(&this_instr[2].cache);
@@ -793,7 +808,9 @@ def test_array_input(self):
793
808
input = """
794
809
inst(OP, (below, values[oparg*2], above --)) {
795
810
SPAM(values, oparg);
811
+ DEAD(below);
796
812
DEAD(values);
813
+ DEAD(above);
797
814
}
798
815
"""
799
816
output = """
@@ -805,8 +822,12 @@ def test_array_input(self):
805
822
frame->instr_ptr = next_instr;
806
823
next_instr += 1;
807
824
INSTRUCTION_STATS(OP);
825
+ _PyStackRef below;
808
826
_PyStackRef *values;
827
+ _PyStackRef above;
828
+ above = stack_pointer[-1];
809
829
values = &stack_pointer[-1 - oparg*2];
830
+ below = stack_pointer[-2 - oparg*2];
810
831
SPAM(values, oparg);
811
832
stack_pointer += -2 - oparg*2;
812
833
assert(WITHIN_STACK_BOUNDS());
@@ -880,6 +901,8 @@ def test_array_input_output(self):
880
901
def test_array_error_if (self ):
881
902
input = """
882
903
inst(OP, (extra, values[oparg] --)) {
904
+ DEAD(extra);
905
+ DEAD(values);
883
906
ERROR_IF(oparg == 0, somewhere);
884
907
}
885
908
"""
@@ -892,6 +915,10 @@ def test_array_error_if(self):
892
915
frame->instr_ptr = next_instr;
893
916
next_instr += 1;
894
917
INSTRUCTION_STATS(OP);
918
+ _PyStackRef extra;
919
+ _PyStackRef *values;
920
+ values = &stack_pointer[-oparg];
921
+ extra = stack_pointer[-1 - oparg];
895
922
if (oparg == 0) {
896
923
stack_pointer += -1 - oparg;
897
924
assert(WITHIN_STACK_BOUNDS());
@@ -1223,7 +1250,7 @@ def test_unused_used_used(self):
1223
1250
}
1224
1251
// THIRD
1225
1252
{
1226
- y = x ;
1253
+ y = stack_pointer[-1] ;
1227
1254
USE(y);
1228
1255
}
1229
1256
DISPATCH();
0 commit comments