Skip to content

Fix stale compileTimeString folds after concat assign (#36244) - #36267

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-36244-compile-time-string-fold
Sep 2, 2026
Merged

Fix stale compileTimeString folds after concat assign (#36244)#36267
PurHur merged 1 commit into
masterfrom
agent/issue-36244-compile-time-string-fold

Conversation

@PurHur

@PurHur PurHur commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix silent wrong strlen() (and similar) folds when a string local is mutated via .= or loop concat — the init compileTimeString literal was winning over later CONCAT ops.
  • Add jitNamedLocalCompileTimeStringInBlock() to take the last in-block CONCAT, sync named bindings after CONCAT lowering, and treat loop-header null back-edges as divergent in jitNamedLocalHasDivergentBranchCompileTimeStrings.
  • Add AOT fixture aot_strlen_after_concat_assign_36244.phpt.

Closes #36244

Verification

./script/aot-smoke.sh
# aot-smoke: 9 passed, 0 failed

./script/phpunit.sh --filter 'aot_strlen_after_concat_assign_36244|aot_catch_assign_call_arg_string_fold_32570'
# OK (2 tests, 10 assertions)

make dev-verify-fast
# dev-verify-fast: OK (88s wall)

# Issue repro (docker-exec):
# loop: xxxxx|5  seq: abcd|4  concat-reassign: axxxxx|6

Not covered

  • Full script/differential-sweep.sh --aot --repeat 3 (dev-verify-fast tier-0 only)
  • make north-star5-verify-fast (no bootstrap/M5 changes)

Made with Cursor

strlen() and other builtins were folding on init literals because promoteCompileTimeStringOnCallArgs walked the first ASSIGN in a block and ignored later CONCAT ops. Scan the last in-block CONCAT, sync named bindings after concat lowering, and treat loop-header null back-edges as divergent so runtime length is used.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 7d0b438 into master Sep 2, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-36244-compile-time-string-fold branch September 2, 2026 00:20
PurHur added a commit that referenced this pull request Sep 2, 2026
#36267)

strlen() and other builtins were folding on init literals because promoteCompileTimeStringOnCallArgs walked the first ASSIGN in a block and ignored later CONCAT ops. Scan the last in-block CONCAT, sync named bindings after concat lowering, and treat loop-header null back-edges as divergent so runtime length is used.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant