Optimization of EQUAL with type that excludes special cases

Bug #1848583 reported by Paul F. Dietz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

Enhancement for the wishlist:

(declaim (optimize speed (safety 0) (compilation-speed 0) (space 0) (debug 0)))
(defun f (x y) (declare (type (not (or array cons number character pathname)) x)) (equal x y))
(disassemble 'f) ==>

; disassembly for F
; Size: 15 bytes. Origin: #x52CF99D6 ; F
; D6: B904000000 MOV ECX, 4
; DB: FF7508 PUSH QWORD PTR [RBP+8]
; DE: B802BA4350 MOV EAX, #x5043BA02 ; #<FDEFN EQUAL>
; E3: FFE0 JMP RAX

With that type declaration, EQUAL is equivalent to EQ, but that optimization has not been performed.

Revision history for this message
Paul F. Dietz (paul-f-dietz) wrote :

(equal "abc" x) is not optimized to string=, although it could be.

In general, these sorts of compile-time dispatch optimizations would be rigorously tested by the existing RTP tests in ansi-tests.

Revision history for this message
Stas Boukarev (stassats) wrote :

55de0ca601bdcfb081edb487b3fca04d45a1d926

Changed in sbcl:
status: New → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
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.