phase29ap(p4): shrink joinir legacy loop pattern table

This commit is contained in:
2025-12-31 04:54:02 +09:00
parent 822b67486b
commit 6910949583
5 changed files with 18 additions and 13 deletions

View File

@ -3,7 +3,7 @@
## Current Focus
- Phase: `docs/development/current/main/phases/phase-29ap/README.md`
- Next: Phase 29ap P4 (planned; see `docs/development/current/main/phases/phase-29ap/README.md`)
- Next: Phase 29ap P5 (planned; see `docs/development/current/main/phases/phase-29ap/README.md`)
## Gate (SSOT)

View File

@ -5,7 +5,7 @@ Scope: 「次にやる候補」を短く列挙するメモ。入口は `docs/dev
## Active
- Phase 29ap: `docs/development/current/main/phases/phase-29ap/README.md` (Next: P4 planned)
- Phase 29ap: `docs/development/current/main/phases/phase-29ap/README.md` (Next: P5 planned)
- JoinIR regression gate SSOT: `docs/development/current/main/phases/phase-29ae/README.md`
- CorePlan hardening (docs-first): `docs/development/current/main/phases/phase-29al/README.md`

View File

@ -34,7 +34,7 @@ Related:
## 1.1 Current (active)
- Active phase: `docs/development/current/main/phases/phase-29ap/README.md`
- Next step: Phase 29ap P4 (planned)
- Next step: Phase 29ap P5 (planned)
## 2. すでに固めた SSOT再発防止の土台

View File

@ -53,7 +53,16 @@ Gate (SSOT):
- No new logs or error strings.
- Fallback remains `Ok(None)` when shape does not match.
## P4: JoinIR legacy table shrink (Pattern8 removal) ✅
- Scope:
- Remove Pattern8 from `LOOP_PATTERNS` so plan/composer stays SSOT for normal loops.
- Keep legacy table as last resort for Pattern2/4/9 only.
- Guardrails:
- No change to logs or error strings.
- Legacy routing remains a last-resort fallback.
## Next (planned)
- P4: Router pattern-name branching reduction (planner outcome + composer SSOT)
- P5: Facts/Feature expansion if needed
- P5: Router pattern-name branching reduction (planner outcome + composer SSOT)
- P6: Facts/Feature expansion if needed

View File

@ -222,7 +222,7 @@ pub(crate) struct LoopPatternEntry {
///
/// **IMPORTANT**: Patterns are tried in array order (SSOT).
/// Array order defines priority - earlier entries are tried first.
/// Pattern4 → Pattern8 → Pattern9 → Pattern2
/// Pattern4 → Pattern9 → Pattern2
///
/// # Current Patterns (Structure-based detection, established Phase 131-11+)
///
@ -243,6 +243,7 @@ pub(crate) struct LoopPatternEntry {
///
/// Note: func_name is now only used for debug logging, not pattern detection
/// Phase 286: Pattern5 removed (migrated to Plan-based routing)
/// Phase 29ap P4: Pattern8 removed (migrated to Plan-based routing)
pub(crate) static LOOP_PATTERNS: &[LoopPatternEntry] = &[
LoopPatternEntry {
name: "Pattern6_NestedLoopMinimal", // Phase 188.3: 1-level nested loop
@ -258,11 +259,6 @@ pub(crate) static LOOP_PATTERNS: &[LoopPatternEntry] = &[
// Pattern6_ScanWithInit now handled via extract_scan_with_init_plan() + PlanLowerer
// Phase 273 P2: Pattern7 entry removed (migrated to Plan-based routing)
// Pattern7_SplitScan now handled via extract_split_scan_plan() + PlanLowerer
LoopPatternEntry {
name: "Pattern8_BoolPredicateScan", // Phase 259 P0: boolean predicate scan (is_integer/is_valid)
detect: super::pattern8_scan_bool_predicate::can_lower,
lower: super::pattern8_scan_bool_predicate::lower,
},
LoopPatternEntry {
name: "Pattern9_AccumConstLoop", // Phase 270 P1: accumulator const loop (橋渡しパターン, before P1)
detect: super::pattern9_accum_const_loop::can_lower,
@ -293,7 +289,7 @@ pub(crate) static LOOP_PATTERNS: &[LoopPatternEntry] = &[
/// This function implements the following routing strategy:
/// 1. Try Plan-based Pattern6 (extract_scan_with_init_plan) → DomainPlan
/// 2. Try Plan-based Pattern7 (extract_split_scan_plan) → DomainPlan
/// 3. Fall through to legacy Pattern2/4/8/9 table for other patterns
/// 3. Fall through to legacy Pattern2/4/9 table for other patterns
///
/// The Plan line (Extractor → Normalizer → Verifier → Lowerer) is the
/// current operational SSOT for Pattern6/7. Legacy patterns (1/2/4/8/9) use
@ -308,7 +304,7 @@ pub(crate) static LOOP_PATTERNS: &[LoopPatternEntry] = &[
/// SSOT Entry Points:
/// - Pattern6: src/mir/builder/control_flow/plan/normalizer.rs (ScanWithInit normalization)
/// - Pattern7: src/mir/builder/control_flow/plan/normalizer.rs (SplitScan normalization)
/// - Pattern2/4/8/9: src/mir/builder/control_flow/joinir/patterns/pattern*.rs (direct lowering)
/// - Pattern2/4/9: src/mir/builder/control_flow/joinir/patterns/pattern*.rs (direct lowering)
pub(crate) fn route_loop_pattern(
builder: &mut MirBuilder,
ctx: &LoopPatternContext,