more aggressive type propagation for local functions' parameter types

Bug #486416 reported by Tobias C. Rittweiler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Confirmed
Wishlist
Unassigned

Bug Description

The following example

  (defun foo (x fn)
    (declare (optimize speed))
    (declare (function fn))
    (labels ((recurse (x fn)
               (if (atom x)
                   (recurse (list x) fn)
                   (mapcar fn x))))
      (recurse x fn)))

will generate the following note

  ; note: unable to
  ; optimize
  ; because:
  ; optimize away possible call to FDEFINITION at runtime

PKhuong said on #lisp that is due to SBCL's conversatism regaring type
propagation: It assumes the top type and tries to refine that to more exact
type:

  <pkhuong> tcr: our propagation pass is conservative (primal, we keep
            refining known truths). For something like the above to
            work, we'd need to use another paradigm, with a dual
            iterative method. This is similar to the issue with naive
            dead variable analysis (primal induction), versus the
            right way (assume everything is dead and find
            counter-examples, co-induction).

Tags: optimization
Revision history for this message
Nikodemus Siivola (nikodemus) wrote : Re: [Bug 486416] [NEW] more aggressive type propagation for local functions' parameter types

  status confirmed
  tag optimization
  importance wishlist
  done

Changed in sbcl:
importance: Undecided → Wishlist
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.