Skip to content

Optimizer: skip leading NOP-free blocks in zend_ssa_remove_nops - #25578

Open
marc-mabe wants to merge 1 commit into
php:masterfrom
marc-mabe:opt-ssa-remove-nops-prefix
Open

marc-mabe wants to merge 1 commit into
php:masterfrom
marc-mabe:opt-ssa-remove-nops-prefix

Conversation

@marc-mabe

Copy link
Copy Markdown
Contributor

Nothing moves before the first NOP: the opcodes stay in place and their shift is 0. Skip the leading reachable blocks without a NOP instead of copying them onto themselves one by one. The scan stops at the first block that is unreachable, keeps only a FREE, or does not start where the previous one ended, so the regular loop handles everything that can move. If the scan reaches the end, nothing moves at all (remove_nops is also set by passes that change an opcode without leaving a NOP), so return before allocating and clearing the shift list. The output is unchanged.

Measured on arm64 Linux VM (via Mac)

workload reps cold master cold head cold Δ cold Δ % cold Δ per rep warm master warm head warm Δ warm Δ % warm Δ per rep
zend-bench 3 2,452,566,939 2,452,565,473 -1,466 -0.0001% -1,381, -1,466, -1,518 - - - - -
symfony-demo 3 857,864,284 857,765,845 -98,439 -0.0115% -1,574,087, -98,427, -98,435 31,155,486 31,155,554 +68 +0.0002% +68, +92, -388
wordpress 3 1,340,814,768 1,340,610,658 -204,110 -0.0152% -204,110, -204,401, -203,678 125,075,130 125,074,869 -261 -0.0002% +18, +252, -355

Nothing moves before the first NOP: the opcodes stay in place and their
shift is 0. Skip the leading reachable blocks without a NOP instead of
copying them onto themselves one by one. The scan stops at the first
block that is unreachable, keeps only a FREE, or does not start where
the previous one ended, so the regular loop handles everything that can
move. If the scan reaches the end, nothing moves at all (remove_nops is
also set by passes that change an opcode without leaving a NOP), so
return before allocating and clearing the shift list. The output is
unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant