fix(mir): Receiver used_values for DCE + trace + cleanup
- Fix: Call with Callee::Method now includes receiver in used_values() - Prevents DCE from eliminating Copy instructions that define receivers - Pattern 3 (loop_if_phi.hako) now works correctly (sum=9) - Add: NYASH_DCE_TRACE=1 for debugging eliminated instructions - Shows which pure instructions DCE removes and from which block - Cleanup: Consolidate Call used_values to single source of truth - Early return in methods.rs handles all Call variants - Removed duplicate match arm (now unreachable!()) - ChatGPT's suggestion for cleaner architecture - Docs: Phase 166 analysis of inst_meta layer architecture - Identified CSE pass callee bug (to be fixed next) - Improvement proposals for CallLikeInst 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -36,6 +36,13 @@ NYASH_OPTION_C_DEBUG=1 cargo test --release TEST_NAME 2>&1 | grep "Option C"
|
||||
# LoopForm デバッグ
|
||||
NYASH_LOOPFORM_DEBUG=1 cargo test --release TEST_NAME 2>&1 | grep "loopform"
|
||||
|
||||
# DCE(Dead Code Elimination)トレース ⭐NEW - 命令が消える問題のデバッグ
|
||||
NYASH_DCE_TRACE=1 ./target/release/hakorune program.hako 2>&1 | grep "\[dce\]"
|
||||
# 出力例:
|
||||
# [dce] Eliminating unused pure instruction in bb12: %29 = Const { dst: ValueId(29), value: Void }
|
||||
# [dce] Eliminating unused pure instruction in bb5: %38 = Copy { dst: ValueId(38), src: ValueId(36) }
|
||||
# → 「命令は emit されてるのに実行時に undefined」問題の原因特定に有効!
|
||||
|
||||
# variable_map トレース (JoinIR PHI接続デバッグ) ⭐超重要
|
||||
NYASH_TRACE_VARMAP=1 cargo test --release TEST_NAME 2>&1 | grep "\[trace:"
|
||||
# 出力例:
|
||||
|
||||
Reference in New Issue
Block a user