X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=OPTIMIZATIONS;h=99d40ea18241b3e569326c90198055f1cdd8f1df;hb=1bbd405c3c21f93db7aa956946738c8a3f30837d;hp=2b2d63b5b69e118fd53ef28c2f876758fefc5a7f;hpb=c5c178ceac9f34b2c3580557fec1ffe15073ac99;p=sbcl.git diff --git a/OPTIMIZATIONS b/OPTIMIZATIONS index 2b2d63b..99d40ea 100644 --- a/OPTIMIZATIONS +++ b/OPTIMIZATIONS @@ -128,7 +128,7 @@ The initial binding is effectless, and without it X is of type DOUBLE-FLOAT. Unhopefully, IR1 does not optimize away effectless SETs/bindings, and IR2 does not perform type inference. -------------------------------------------------------------------------------- -#9 +#9 "Multi-path constant folding" (defun foo (x) (if (= (cond ((irgh x) 0) ((buh x) 1) @@ -144,28 +144,17 @@ This code could be optimized to ((buh x) :no) (t :no))) -------------------------------------------------------------------------------- -#10 -Reported by Robert E. Brown on sbcl-devel 2003-01-21: +#11 +(inverted variant of #9) -(defstruct trace-info - (foo nil :type (or null function))) +(lambda (x) + (let ((y (sap-alien x c-string))) + (list (alien-sap y) + (alien-sap y)))) -(defun bad (x) - (declare (optimize (speed 3) (safety 0))) - (let ((wow (trace-info-foo x))) - (or (not wow) (funcall wow 1 2 3)))) +It could be optimized to -Python does not derive that FUNCALL is applied to FUNCTION. +(lambda (x) (list x x)) -(OR ...) is equivalent to - -(LET ((G2407 (NOT WOW))) - (IF G2407 G2407 (FUNCALL WOW 1 2 3))) - -or to - -(LET ((G2407 (IF WOW NIL T))) - (IF G2407 G2407 (FUNCALL WOW 1 2 3))) - -so this is similar to #9. +(if Y were used only once, the current compiler would optimize it) --------------------------------------------------------------------------------