GH-115819: Eliminate Boolean guards when value is known (GH-116355)
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user