mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
GH-115819: Eliminate Boolean guards when value is known (GH-116355)
This commit is contained in:
parent
c91bdf86ef
commit
0c81ce1360
6 changed files with 102 additions and 2 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue