Skip to content

#240's premise hook is inert: assume_max/assume_range have no non-test callers, so fits_below_bit can never fire #323

Description

@avrabe

OptimizationEnv::assume_max / assume_range — the value-range premise hook added for #240's "proof-carrying IR premises" half — have no non-test callers. The optimizer never produces a premise through them.

Evidence

Every call site is inside a test module:

loom-core/src/lib.rs:22523    env.assume_range(...)   # wsc_facts_factset_tests
loom-core/src/lib.rs:22538    env.assume_range(...)   # wsc_facts_factset_tests
loom-core/src/lib.rs:22551-2  env.assume_range(...)   # wsc_facts_factset_tests
loom-shared/src/lib.rs:6886   env.assume_max(...)     # tests
loom-shared/src/lib.rs:6904   env.assume_max(...)     # tests
loom-shared/src/lib.rs:2831   self.assume_range(...)  # inside assume_max itself

Surfaced while wiring the #231 fact source (#322): the agent planned to harvest facts from premises the mid-end had already derived, and found there were none to harvest. The consumer of the hook was written before any producer existed.

Why it matters

fits_below_bit — the gate that lets the mid-end drop a redundant mask — can only fire when something has asserted a bound. With no producers, that gate is permanently false, so the #240 premise-driven rewrites cannot trigger on real input. The rules are implemented and unit-tested against hand-asserted premises, and inert in the pipeline.

This is the same shape as three other findings in this repo: a trap gate with 19 passing tests and zero callers (#288), a pin defended only by a comment (#311/#318), and a proof that had never run. In each case the artifact exists, is tested, looks maintained — and is not connected to anything. Tests prove a component works; they do not prove anything calls it.

What to do

  1. Decide whether Carry Verus value-range/no-alias facts as IR premises + algebraic mid-end — feed synth's beat-LLVM specialization #240's premise half is wanted. If yes, wire a producer: the obvious candidates are the same structural sources feat(#231): wire the wsc.facts value-range SOURCE (constants, masks, booleans) #322 uses (mask ⇒ [0,K], constant ⇒ [c,c]) plus anything the guard/branch analysis already knows. If no, delete the hook rather than leave a tested-but-unreachable API implying capability we do not have.
  2. Either way, add the anti-regression test that would have caught this: assert the premise path is exercised end-to-end by a pass on a real module, not just by a test that calls assume_range itself. Same fix pattern as fix(#288): wire trap_gate onto the runtime path (additive trap backstop) #289 used for the trap gate — make reachability the asserted property, not just correctness.

Refs #240, #231, #322, #288

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions