refactor(llvm): Phase 132-P1 follow-up - bind block_end_values and clear predeclared PHIs

This commit is contained in:
nyash-codex
2025-12-15 11:47:58 +09:00
parent e0fb6fecf6
commit a15d1e97e6
3 changed files with 41 additions and 1 deletions

View File

@ -27,6 +27,16 @@
- Investigation: [phase132-llvm-exit-phi-wrong-result.md](investigations/phase132-llvm-exit-phi-wrong-result.md)
- Phase summary: [phases/phase-132/README.md](phases/phase-132/README.md)
## Phase 132-P1 Update (2025-12-15)
**STRUCTURAL FIX**: Function-local state isolation in LLVM Python backend
- **Issue**: block id / value id が “関数をまたいで” 衝突し得るsnapshot / cache / PHI state の漏洩)
- **Fix**: `FunctionLowerContext` Box で function-scoped state を隔離し、tuple-key workaround を不要化
- **Code**:
- `src/llvm_py/context/function_lower_context.py`
- `src/llvm_py/builders/function_lower.py`
## Root Causes Identified
### 1. TAG-EMIT: Loop PHI → Invalid LLVM IR (Case B) ✅ FIXED (Phase 131-10)