tomoaki
661bbe1ab7
feat(phase284): P1 Complete - Return in Loop with Block Remap Fix
## Summary
Completed Phase 284 P1: Enable return statements in Pattern4/5 loops via
JoinInst::Ret infrastructure (100% pre-existing, no new infrastructure needed).
**Critical Bug Fix**: Block ID remap priority
- Fixed: local_block_map must take precedence over skipped_entry_redirects
- Root cause: Function-local block IDs can collide with global remap entries
(example: loop_step:bb4 vs k_exit:bb4 after merge allocation)
- Impact: Conditional Jump else branches were incorrectly redirected to exit
- Solution: Check local_block_map FIRST, then skipped_entry_redirects
## Implementation
### New Files
- `src/mir/join_ir/lowering/return_collector.rs` - Return detection SSOT (top-level only, P1 scope)
- `apps/tests/phase284_p1_return_in_loop_min.hako` - Test fixture (exit code 7)
- Smoke test scripts (VM/LLVM)
### Modified Files
- `loop_with_continue_minimal.rs`: Return condition check + Jump generation
- `pattern4_with_continue.rs`: K_RETURN registration in continuation_funcs
- `canonical_names.rs`: K_RETURN constant
- `instruction_rewriter.rs`: Fixed Branch remap priority (P1 fix)
- `terminator.rs`: Fixed Jump/Branch remap priority (P1 fix)
- `conversion_pipeline.rs`: Return normalization support
## Testing
✅ VM: exit=7 PASS
✅ LLVM: exit=7 PASS
✅ Baseline: 46 PASS, 1 FAIL (pre-existing emit issue)
✅ Zero regression
## Design Notes
- JoinInst::Ret infrastructure was 100% complete before P1
- Bridge automatically converts JoinInst::Ret → MIR Return terminator
- Pattern4/5 now properly merge k_return as non-skippable continuation
- Correct semantics: true condition → return, false → continue loop
## Next Phase (P2+)
- Refactor: Block remap SSOT (block_remapper.rs)
- Refactor: Return jump emitter extraction
- Scope: Nested if/loop returns, multiple returns
- Design: Standardize early exit pattern (return/break/continue as Jump with cond)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-23 14:21:27 +09:00
..
2025-12-23 14:21:27 +09:00
2025-12-21 09:39:20 +09:00
2025-11-21 06:25:17 +09:00
2025-12-08 23:43:26 +09:00
2025-12-21 04:34:22 +09:00
2025-11-30 04:35:40 +09:00
2025-12-23 14:21:27 +09:00
2025-12-23 04:11:02 +09:00
2025-12-11 20:54:33 +09:00
2025-12-20 11:01:48 +09:00
2025-12-21 11:49:03 +09:00
2025-11-30 14:30:28 +09:00
2025-12-21 05:47:37 +09:00
2025-12-21 04:34:22 +09:00
2025-12-22 14:48:37 +09:00
2025-12-16 07:02:14 +09:00
2025-12-21 04:34:22 +09:00
2025-12-22 15:34:03 +09:00
2025-12-21 04:34:22 +09:00
2025-12-23 00:11:20 +09:00
2025-11-21 06:25:17 +09:00
2025-12-21 09:39:20 +09:00
2025-12-13 05:34:56 +09:00
2025-12-21 04:34:22 +09:00
2025-12-07 23:45:55 +09:00
2025-12-21 12:49:53 +09:00
2025-12-03 13:59:06 +09:00
2025-12-21 04:34:22 +09:00
2025-12-21 04:34:22 +09:00
2025-12-15 22:03:34 +09:00
2025-09-17 07:43:07 +09:00
2025-12-21 04:34:22 +09:00
2025-12-05 15:45:42 +09:00
2025-12-16 07:02:14 +09:00
2025-12-21 04:34:22 +09:00
2025-11-24 14:17:02 +09:00
2025-12-22 15:34:03 +09:00
2025-11-24 14:17:02 +09:00
2025-09-17 07:43:07 +09:00
2025-12-21 04:34:22 +09:00
2025-12-21 04:34:22 +09:00
2025-12-05 19:39:54 +09:00
2025-12-20 03:20:55 +09:00
2025-09-24 09:30:42 +09:00
2025-11-24 15:02:51 +09:00
2025-11-21 06:25:17 +09:00
2025-11-17 09:45:03 +09:00
2025-11-24 15:02:51 +09:00
2025-11-21 06:25:17 +09:00
2025-12-20 23:30:27 +09:00