diff options
author | Mark Shannon <mark@hotpy.org> | 2024-03-05 15:06:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-05 15:06:00 (GMT) |
commit | 0c81ce13602b88fd59f23f701ed8dc377d74e76e (patch) | |
tree | dbcf462118f71fa97906409414099cdd2b8ca241 /Python/optimizer_analysis.c | |
parent | c91bdf86ef1cf9365b61a46aa2e51e5d1932b00a (diff) | |
download | cpython-0c81ce13602b88fd59f23f701ed8dc377d74e76e.zip cpython-0c81ce13602b88fd59f23f701ed8dc377d74e76e.tar.gz cpython-0c81ce13602b88fd59f23f701ed8dc377d74e76e.tar.bz2 |
GH-115819: Eliminate Boolean guards when value is known (GH-116355)
Diffstat (limited to 'Python/optimizer_analysis.c')
-rw-r--r-- | Python/optimizer_analysis.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c index 1e1d552..21cccdb 100644 --- a/Python/optimizer_analysis.c +++ b/Python/optimizer_analysis.c @@ -292,6 +292,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer, #define sym_is_null _Py_uop_sym_is_null #define sym_new_const _Py_uop_sym_new_const #define sym_new_null _Py_uop_sym_new_null +#define sym_has_type _Py_uop_sym_has_type #define sym_matches_type _Py_uop_sym_matches_type #define sym_set_null _Py_uop_sym_set_null #define sym_set_non_null _Py_uop_sym_set_non_null @@ -324,6 +325,16 @@ optimize_to_bool( return 0; } +static void +eliminate_pop_guard(_PyUOpInstruction *this_instr, bool exit) +{ + REPLACE_OP(this_instr, _POP_TOP, 0, 0); + if (exit) { + REPLACE_OP((this_instr+1), _EXIT_TRACE, 0, 0); + this_instr[1].target = this_instr->target; + } +} + /* 1 for success, 0 for not ready, cannot error at the moment. */ static int optimize_uops( |