See through or/and in truthy-elision (#224)
A loop test like (or (>= i cap) (> ... 4.0)) desugars to (let* [g (>= i cap)] (if (truthy? g) g (> ... 4.0))) and the whole thing was wrapped in jolt-truthy? because returns-scheme-bool? only looked at :const and :invoke nodes, not the let*/if an or/and expands to. The wrapper defeats Chez's branch inlining on the hot loop edge. Make returns-scheme-bool? recursive over :if (both branches bool), :let (body bool, tracking which bound locals hold a Scheme boolean), and :local (in that set). or/and over bool-returning ops then read as Scheme booleans and the outer wrapper drops. Still sound: eliding only when the value is provably #t/#f — a jolt-nil is a truthy record in Chez, so a false positive would be a real bug, and the recursion only proves bool-ness through ops already known to return one. No bench regression; the win lands on hinted float loops where the branch, not boxed arithmetic, is the cost. Co-authored-by: Yogthos <yogthos@gmail.com>
This commit is contained in:
parent
0a7e818700
commit
93be40f3fe
3 changed files with 131 additions and 113 deletions
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue