From 17fc8a3e5395bd48f7f8f5f8f204686a3ed2e360 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Sun, 16 Jul 2023 15:25:05 +0900 Subject: [PATCH] Skip if statement for always true case --- Python/generated_cases.c.h | 6 +++--- Tools/cases_generator/generate_cases.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 9dca2ec3bba3db..392914c0521e9d 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -3362,7 +3362,7 @@ res = self; STACK_GROW(1); stack_pointer[-1] = res; - if (1) { stack_pointer[-(1 + 1)] = res2; } + stack_pointer[-(1 + 1)] = res2; next_instr += 9; DISPATCH(); } @@ -3384,7 +3384,7 @@ res = self; STACK_GROW(1); stack_pointer[-1] = res; - if (1) { stack_pointer[-(1 + 1)] = res2; } + stack_pointer[-(1 + 1)] = res2; next_instr += 9; DISPATCH(); } @@ -3456,7 +3456,7 @@ res = self; STACK_GROW(1); stack_pointer[-1] = res; - if (1) { stack_pointer[-(1 + 1)] = res2; } + stack_pointer[-(1 + 1)] = res2; next_instr += 9; DISPATCH(); } diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py index 3f6da2e9b1baec..06ce40b25a03ab 100644 --- a/Tools/cases_generator/generate_cases.py +++ b/Tools/cases_generator/generate_cases.py @@ -250,7 +250,7 @@ def assign(self, dst: StackEffect, src: StackEffect): self.emit(f"Py_XSETREF({dst.name}, {cast}{src.name});") else: stmt = f"{dst.name} = {cast}{src.name};" - if src.cond: + if src.cond and src.cond != "1": if src.cond == "0": # It will not be executed return