phase29ai(p13): memoize planner call in single_planner
This commit is contained in:
@ -13,6 +13,9 @@ use crate::mir::builder::control_flow::plan::DomainPlan;
|
||||
pub(super) fn try_build_domain_plan(ctx: &LoopPatternContext) -> Result<Option<DomainPlan>, String> {
|
||||
use crate::mir::builder::control_flow::joinir::trace;
|
||||
|
||||
let planner_opt = planner::build_plan(ctx.condition, ctx.body)
|
||||
.map_err(|freeze| freeze.to_string())?;
|
||||
|
||||
// NOTE: Names must match the previous PLAN_EXTRACTORS entries exactly.
|
||||
// Order must match exactly.
|
||||
let rules: &[RuleEntry] = &[
|
||||
@ -66,26 +69,20 @@ pub(super) fn try_build_domain_plan(ctx: &LoopPatternContext) -> Result<Option<D
|
||||
let (plan_opt, log_none) = match entry.kind {
|
||||
RuleKind::Simple(extract) => (extract(ctx)?, true),
|
||||
RuleKind::Pattern6 => {
|
||||
let from_planner = planner::build_plan(ctx.condition, ctx.body)
|
||||
.map_err(|freeze| freeze.to_string())?;
|
||||
match from_planner {
|
||||
Some(plan) => (Some(plan), false),
|
||||
None => (legacy_rules::pattern6::extract(ctx)?, true),
|
||||
match planner_opt.as_ref() {
|
||||
Some(DomainPlan::ScanWithInit(_)) => (planner_opt.clone(), false),
|
||||
_ => (legacy_rules::pattern6::extract(ctx)?, true),
|
||||
}
|
||||
}
|
||||
RuleKind::Pattern7 => {
|
||||
let from_planner = planner::build_plan(ctx.condition, ctx.body)
|
||||
.map_err(|freeze| freeze.to_string())?;
|
||||
match from_planner {
|
||||
Some(plan) => (Some(plan), false),
|
||||
None => (legacy_rules::pattern7::extract(ctx)?, true),
|
||||
match planner_opt.as_ref() {
|
||||
Some(DomainPlan::SplitScan(_)) => (planner_opt.clone(), false),
|
||||
_ => (legacy_rules::pattern7::extract(ctx)?, true),
|
||||
}
|
||||
}
|
||||
RuleKind::Pattern2 => {
|
||||
let from_planner = planner::build_plan(ctx.condition, ctx.body)
|
||||
.map_err(|freeze| freeze.to_string())?;
|
||||
match from_planner {
|
||||
Some(DomainPlan::Pattern2Break(_)) => (from_planner, false),
|
||||
match planner_opt.as_ref() {
|
||||
Some(DomainPlan::Pattern2Break(_)) => (planner_opt.clone(), false),
|
||||
_ => (legacy_rules::pattern2::extract(ctx)?, true),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user