Skip to content

Backport IR fixes - #25193

Open
ndossche wants to merge 3 commits into
php:PHP-8.4from
ndossche:ir-backport-2
Open

ndossche wants to merge 3 commits into
php:PHP-8.4from
ndossche:ir-backport-2

Conversation

@ndossche

@ndossche ndossche commented Nov 4, 2026

Copy link
Copy Markdown
Member

Backport IR fold fixes

Fixes GH-24801
Blocked by GH-25180

The shared IR_FOLD(AND(AND, _)) / OR / MIN / MAX rule folded
(a op b) op a to a instead of a op b, e.g. `$b | ($b | 7)` evaluated to
`$b` under the function JIT.

Cherry-picks dstogov/ir@6221481

@iliaal iliaal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Would you mind backporting dstogov/ir@a38079e as well, it fixes #25037

@jorgsowa jorgsowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IR update has been merged to master

@ndossche

ndossche commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

@iliaal Yeah I'll cherry-pick, hang on pls

@ndossche ndossche changed the title Backport IR fold fixes Backport IR fixes Nov 5, 2026
IR: Backport fix for loop-invariant hoisting across external entries.
Mark loops reached from an ENTRY that bypasses their immediate dominator
with IR_BB_LOOP_WITH_ENTRY_IN_PREDS, so GCM cannot hoist unbound
invariants across those entries.

Cherry-picks dstogov/ir@a38079e
adapted to the older IR in this branch: the check is placed in the
sorted_blocks loop of ir_find_loops().

Fixes phpGH-25037
@ndossche

ndossche commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

The last backport commit also shows we're starting to run into issues with backporting IR changes. Since the upstream IR source has a slightly different loop due to other changes, I had to port the code. This shows that we're going to have an error-prone process with backporting going forward the more upstream IR starts to diverge from the versions in stable branches.

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.

JIT: SIGFPE in ir_fold MUL_OV constant folding for $x = -1; $x *= PHP_INT_MIN in a hot loop

4 participants