Files
hakorune/src/mir/builder/control_flow
nyash-codex bcdad203f0 feat(joinir): Phase 222-3 if-sum normalization integration
Phase 222: If Condition Normalization - Part 3
Goal: Integrate normalization into if-sum pattern detection and lowering

Changes:
1. pattern_pipeline.rs (is_if_sum_pattern):
   - Updated to use analyze_condition_pattern() + normalize_comparison()
   - Added two-step validation:
     (a) Pattern must be SimpleComparison
     (b) Condition must be normalizable
   - Replaced is_simple_comparison() with Phase 222 API

2. loop_with_if_phi_if_sum.rs (extract_loop_condition):
   - Added Phase 222 normalization
   - Normalize condition to canonical form (var on left)
   - Support both literal and variable on right-hand side
   - Added mir::CompareOp → join_ir::CompareOp conversion
   - Handles:
     * Phase 219: var CmpOp literal (e.g., i > 0)
     * Phase 222: literal CmpOp var (e.g., 0 < i) → normalized
     * Phase 222: var CmpOp var (e.g., i > j)

Status: Integration complete, ready for E2E testing
Next: Phase 222-4 - verify regression tests and add new test cases
2025-12-10 09:23:44 +09:00
..