Hoist the crossed offset test in fast.cpp

Test end.offset <= 1 before revTruncLeOneLow in the reversed crossed
dispatch, and specialize revTruncLeOneLow under that path fact.  The
helper drops the now-tautological end.offset conjuncts and the key
comparison implied by a failed optLe.

The crossed truncated reverse benchmark drops from about 67 ns to
about 61 ns.  Sweep, corpus, SMT cases, and 100% line and branch
coverage still pass.
This commit is contained in:
andrew committed 2026-11-18 14:14:44 -05:00
1 parent e1395f20ef
commit e351a0cf8d
2 files changed
+19 -20

No files matched your search

+3 -2
View File
@@ -132,7 +132,7 @@ coverage. `sweep_test` alone covers every region, function, line, and
branch side of the summarised implementation:
```text
src/fast.cpp 560 regions (0 missed) 121 functions (0 missed) 675 lines (0 missed) 374 branches (0 missed)
src/fast.cpp 553 regions (0 missed) 119 functions (0 missed) 668 lines (0 missed) 362 branches (0 missed)
```
That is 100.00% line, function, region, and branch coverage. Offset 5 is part of
@@ -142,7 +142,8 @@ which the previous `[-3, 4]` window missed.
Because equivalence is only promised on readable inputs, `src/fast.cpp` deletes
both unreachable control-flow branches and predicate operands that an enclosing
dispatch invariant fixes. Examples include the complete-closed family, the
offset-one total/any wrappers, the `end.offset <= 1` shortcuts, the
offset-one total/any wrappers, the hoisted and specialised
`end.offset <= 1` / `revTruncLeOneLow` path split, the
`crossedCompleteEndLeOne` guard, and the repeated
`!c.r->reverse`/`!o.more`/offset tests inside subtrees that are only entered
after those tests succeeded. `literal.cpp` keeps the full Lean conditions so the