Skip to content

fix: hoist allocas out of conditional branches in split and lastIndexOf#299

Merged
cs01 merged 1 commit intomainfrom
fix-hoist-alloca-search-split
Mar 12, 2026
Merged

fix: hoist allocas out of conditional branches in split and lastIndexOf#299
cs01 merged 1 commit intomainfrom
fix-hoist-alloca-search-split

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 12, 2026

Summary

  • Hoists 8 alloca instructions from inside conditional branches to the function entry block in generateSplit (6 allocas) and generateLastIndexOfFrom (2 allocas)
  • Prevents undefined behavior where LLVM stack slots may not exist when accessed from other basic blocks
  • Same class of bug as fix: hoist alloca out of conditional branch in generateReplaceAll #298 (replaceAll)

Test plan

  • npm run verify:quick passes (tests + Stage 1 self-hosting)
  • All string split and lastIndexOf tests continue to pass

🤖 Generated with Claude Code

@cs01 cs01 merged commit d652181 into main Mar 12, 2026
12 checks passed
@cs01 cs01 deleted the fix-hoist-alloca-search-split branch March 19, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant