Skip to content

Commit 3644fa2

Browse files
committed
Zend/Optimizer: add const qualifier to visit_phi's phi parameter
1 parent 93cba98 commit 3644fa2

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

Zend/Optimizer/sccp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,7 @@ static void join_phi_values(zval *a, zval *b, bool escape) {
20372037
}
20382038
}
20392039

2040-
static void sccp_visit_phi(scdf_ctx *scdf, zend_ssa_phi *phi) {
2040+
static void sccp_visit_phi(scdf_ctx *scdf, const zend_ssa_phi *phi) {
20412041
sccp_ctx *ctx = (sccp_ctx *) scdf;
20422042
zend_ssa *ssa = scdf->ssa;
20432043
ZEND_ASSERT(phi->ssa_var >= 0);

Zend/Optimizer/scdf.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ void scdf_mark_edge_feasible(scdf_ctx *scdf, int from, int to) {
7171
/* Block is already executable, only a new edge became feasible.
7272
* Reevaluate phi nodes to account for changed source operands. */
7373
const zend_ssa_block *ssa_block = &scdf->ssa->blocks[to];
74-
zend_ssa_phi *phi;
75-
for (phi = ssa_block->phis; phi; phi = phi->next) {
74+
for (const zend_ssa_phi *phi = ssa_block->phis; phi; phi = phi->next) {
7675
zend_bitset_excl(scdf->phi_var_worklist, phi->ssa_var);
7776
scdf->handlers.visit_phi(scdf, phi);
7877
}
@@ -109,7 +108,7 @@ void scdf_solve(scdf_ctx *scdf, const char *name) {
109108
) {
110109
int i;
111110
while ((i = zend_bitset_pop_first(scdf->phi_var_worklist, scdf->phi_var_worklist_len)) >= 0) {
112-
zend_ssa_phi *phi = ssa->vars[i].definition_phi;
111+
const zend_ssa_phi *phi = ssa->vars[i].definition_phi;
113112
ZEND_ASSERT(phi);
114113
if (zend_bitset_in(scdf->executable_blocks, phi->block)) {
115114
scdf->handlers.visit_phi(scdf, phi);
@@ -145,12 +144,9 @@ void scdf_solve(scdf_ctx *scdf, const char *name) {
145144
DEBUG_PRINT("Pop block %d from worklist\n", i);
146145
zend_bitset_incl(scdf->executable_blocks, i);
147146

148-
{
149-
zend_ssa_phi *phi;
150-
for (phi = ssa_block->phis; phi; phi = phi->next) {
151-
zend_bitset_excl(scdf->phi_var_worklist, phi->ssa_var);
152-
scdf->handlers.visit_phi(scdf, phi);
153-
}
147+
for (const zend_ssa_phi *phi = ssa_block->phis; phi; phi = phi->next) {
148+
zend_bitset_excl(scdf->phi_var_worklist, phi->ssa_var);
149+
scdf->handlers.visit_phi(scdf, phi);
154150
}
155151

156152
if (block->len == 0) {

Zend/Optimizer/scdf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef struct _scdf_ctx {
3939
void (*visit_instr)(
4040
struct _scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_op);
4141
void (*visit_phi)(
42-
struct _scdf_ctx *scdf, zend_ssa_phi *phi);
42+
struct _scdf_ctx *scdf, const zend_ssa_phi *phi);
4343
void (*mark_feasible_successors)(
4444
struct _scdf_ctx *scdf, int block_num, zend_basic_block *block,
4545
zend_op *opline, zend_ssa_op *ssa_op);

0 commit comments

Comments
 (0)