mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Replace conditions, that should be always true, by ZEND_ASSERT()
This commit is contained in:
parent
9915b1f5cd
commit
4872d139b5
4 changed files with 43 additions and 41 deletions
|
@ -1192,13 +1192,14 @@ static void sccp_visit_phi(scdf_ctx *scdf, zend_ssa_phi *phi) {
|
|||
MAKE_TOP(&result);
|
||||
SCP_DEBUG("Handling PHI(");
|
||||
if (phi->pi >= 0) {
|
||||
if (phi->sources[0] >= 0 && scdf_is_edge_feasible(scdf, phi->pi, phi->block)) {
|
||||
ZEND_ASSERT(phi->sources[0] >= 0);
|
||||
if (scdf_is_edge_feasible(scdf, phi->pi, phi->block)) {
|
||||
join_phi_values(&result, &ctx->values[phi->sources[0]]);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < block->predecessors_count; i++) {
|
||||
if (phi->sources[i] >= 0
|
||||
&& scdf_is_edge_feasible(scdf, predecessors[i], phi->block)) {
|
||||
ZEND_ASSERT(phi->sources[i] >= 0);
|
||||
if (scdf_is_edge_feasible(scdf, predecessors[i], phi->block)) {
|
||||
SCP_DEBUG("val, ");
|
||||
join_phi_values(&result, &ctx->values[phi->sources[i]]);
|
||||
} else {
|
||||
|
|
|
@ -282,7 +282,8 @@ int zend_ssa_find_false_dependencies(const zend_op_array *op_array, zend_ssa *ss
|
|||
}
|
||||
} else {
|
||||
for (j = 0; j < ssa->cfg.blocks[p->block].predecessors_count; j++) {
|
||||
if (p->sources[j] >= 0 && ssa->vars[p->sources[j]].no_val) {
|
||||
ZEND_ASSERT(p->sources[j] >= 0);
|
||||
if (ssa->vars[p->sources[j]].no_val) {
|
||||
ssa_vars[p->sources[j]].no_val = 0; /* used indirectly */
|
||||
zend_bitset_incl(worklist, p->sources[j]);
|
||||
}
|
||||
|
@ -854,7 +855,8 @@ int zend_inference_calc_range(const zend_op_array *op_array, zend_ssa *ssa, int
|
|||
}
|
||||
} else {
|
||||
for (i = 0; i < ssa->cfg.blocks[p->block].predecessors_count; i++) {
|
||||
if (p->sources[i] >= 0 && ssa->var_info[p->sources[i]].has_range) {
|
||||
ZEND_ASSERT(p->sources[i] >= 0);
|
||||
if (ssa->var_info[p->sources[i]].has_range) {
|
||||
/* union */
|
||||
tmp->underflow |= ssa->var_info[p->sources[i]].range.underflow;
|
||||
tmp->min = MIN(tmp->min, ssa->var_info[p->sources[i]].range.min);
|
||||
|
@ -3328,8 +3330,10 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script
|
|||
}
|
||||
UPDATE_SSA_TYPE(tmp, j);
|
||||
for (i = 0; i < blocks[p->block].predecessors_count; i++) {
|
||||
if (p->sources[i] >= 0) {
|
||||
zend_ssa_var_info *info = &ssa_var_info[p->sources[i]];
|
||||
zend_ssa_var_info *info;
|
||||
|
||||
ZEND_ASSERT(p->sources[i] >= 0);
|
||||
info = &ssa_var_info[p->sources[i]];
|
||||
if (info->type & MAY_BE_OBJECT) {
|
||||
if (first) {
|
||||
ce = info->ce;
|
||||
|
@ -3341,7 +3345,6 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UPDATE_SSA_OBJ_TYPE(ce, ce ? is_instanceof : 0, j);
|
||||
}
|
||||
} else if (ssa_vars[j].definition >= 0) {
|
||||
|
|
|
@ -1061,8 +1061,10 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_
|
|||
ssa_vars[phi->ssa_var].var = phi->var;
|
||||
ssa_vars[phi->ssa_var].definition_phi = phi;
|
||||
if (phi->pi >= 0) {
|
||||
if (phi->sources[0] >= 0) {
|
||||
zend_ssa_phi *p = ssa_vars[phi->sources[0]].phi_use_chain;
|
||||
zend_ssa_phi *p;
|
||||
|
||||
ZEND_ASSERT(phi->sources[0] >= 0);
|
||||
p = ssa_vars[phi->sources[0]].phi_use_chain;
|
||||
while (p && p != phi) {
|
||||
p = zend_ssa_next_use_phi(ssa, phi->sources[0], p);
|
||||
}
|
||||
|
@ -1070,7 +1072,6 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_
|
|||
phi->use_chains[0] = ssa_vars[phi->sources[0]].phi_use_chain;
|
||||
ssa_vars[phi->sources[0]].phi_use_chain = phi;
|
||||
}
|
||||
}
|
||||
if (phi->has_range_constraint) {
|
||||
/* min and max variables can't be used together */
|
||||
zend_ssa_range_constraint *constraint = &phi->constraint.range;
|
||||
|
@ -1086,8 +1087,10 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_
|
|||
int j;
|
||||
|
||||
for (j = 0; j < ssa->cfg.blocks[i].predecessors_count; j++) {
|
||||
if (phi->sources[j] >= 0) {
|
||||
zend_ssa_phi *p = ssa_vars[phi->sources[j]].phi_use_chain;
|
||||
zend_ssa_phi *p;
|
||||
|
||||
ZEND_ASSERT(phi->sources[j] >= 0);
|
||||
p = ssa_vars[phi->sources[j]].phi_use_chain;
|
||||
while (p && p != phi) {
|
||||
p = zend_ssa_next_use_phi(ssa, phi->sources[j], p);
|
||||
}
|
||||
|
@ -1097,7 +1100,6 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
phi = phi->next;
|
||||
}
|
||||
}
|
||||
|
@ -1315,9 +1317,6 @@ void zend_ssa_remove_uses_of_var(zend_ssa *ssa, int var_num) /* {{{ */
|
|||
int i, end = NUM_PHI_SOURCES(phi);
|
||||
for (i = 0; i < end; i++) {
|
||||
if (phi->sources[i] == var_num) {
|
||||
#if 0
|
||||
phi->sources[i] = -1;
|
||||
#endif
|
||||
phi->use_chains[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1395,11 +1394,10 @@ void zend_ssa_remove_block(zend_op_array *op_array, zend_ssa *ssa, int i) /* {{{
|
|||
zend_ssa_remove_phi(ssa, phi);
|
||||
}
|
||||
} else {
|
||||
if (phi->sources[pred_offset] >= 0) {
|
||||
ZEND_ASSERT(phi->sources[pred_offset] >= 0);
|
||||
zend_ssa_remove_phi_source(ssa, phi, pred_offset, next_block->predecessors_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove this predecessor */
|
||||
next_block->predecessors_count--;
|
||||
|
|
|
@ -240,7 +240,7 @@ static zend_always_inline zend_bool zend_ssa_is_no_val_use(const zend_op *opline
|
|||
zend_ssa_phi *_phi = (phi); \
|
||||
int _i, _end = NUM_PHI_SOURCES(phi); \
|
||||
for (_i = 0; _i < _end; _i++) { \
|
||||
if (_phi->sources[_i] < 0) continue; \
|
||||
ZEND_ASSERT(_phi->sources[_i] >= 0); \
|
||||
source = _phi->sources[_i];
|
||||
#define FOREACH_PHI_SOURCE_END() \
|
||||
} \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue