diff --git a/test/test-utilities.script b/test/test-utilities.script
index 4656a430abf474477e39c2d3426c19a162a6ca51..3c5677f17fbbea13987992287dc5fea288c90ee9 100644
--- a/test/test-utilities.script
+++ b/test/test-utilities.script
@@ -314,7 +314,7 @@
   (assert-equal (multiple-value-list (ensure-gethash 3 h 5)) '(nil t)))
 
 (DBG :optimization-settings)
-#-(or allegro ecl-bytecmp gcl mkcl)
+#-(or ecl-bytecmp gcl mkcl)
 (loop :with settings = (get-optimization-settings)
       :for i :from 0 :to 3 :do
         (with-optimization-settings (`((speed ,i) (space ,i) (safety ,i) (debug ,i)))
diff --git a/uiop/lisp-build.lisp b/uiop/lisp-build.lisp
index d32adef217a7ef1cd851b6efcabd82880f14cb23..6b105a4442a8b59932fcfb472e03a5eecbe34de0 100644
--- a/uiop/lisp-build.lisp
+++ b/uiop/lisp-build.lisp
@@ -74,15 +74,18 @@ This can help you produce more deterministic output for FASLs."))
         #+sbcl '(sb-c::*policy*)))
   (defun get-optimization-settings ()
     "Get current compiler optimization settings, ready to PROCLAIM again"
-    #-(or abcl clisp clozure cmu ecl lispworks mkcl sbcl scl xcl)
+    #-(or abcl allegro clisp clozure cmu ecl lispworks mkcl sbcl scl xcl)
     (warn "~S does not support ~S. Please help me fix that."
           'get-optimization-settings (implementation-type))
-    #+clozure (ccl:declaration-information 'optimize nil)
-    #+(or abcl clisp cmu ecl lispworks mkcl sbcl scl xcl)
+    #+(or abcl allegro clisp clozure cmu ecl lispworks mkcl sbcl scl xcl)
     (let ((settings '(speed space safety debug compilation-speed #+(or cmu scl) c::brevity)))
-      #.`(loop :for x :in settings
+      #.`(loop #+(or allegro clozure)
+               ,@'(:with info = #+allegro (sys:declaration-information 'optimize)
+                   #+clozure (ccl:declaration-information 'optimize nil))
+               :for x :in settings
                ,@(or #+(or abcl ecl gcl mkcl xcl) '(:for v :in +optimization-variables+))
-               :for y = (or #+clisp (gethash x system::*optimize* 0)
+               :for y = (or #+(or allegro clozure) (second (assoc x info)) ; normalize order
+                            #+clisp (gethash x system::*optimize* 1)
                             #+(or abcl ecl mkcl xcl) (symbol-value v)
                             #+(or cmu scl) (slot-value c::*default-cookie*
                                                        (case x (compilation-speed 'c::cspeed)
@@ -97,13 +100,13 @@ This can help you produce more deterministic output for FASLs."))
       (unless (equal *previous-optimization-settings* settings)
         (setf *previous-optimization-settings* settings))))
   (defmacro with-optimization-settings ((&optional (settings *optimization-settings*)) &body body)
-    #+clisp
+    #+(or allegro clisp)
     (let ((previous-settings (gensym "PREVIOUS-SETTINGS")))
       `(let ((,previous-settings (get-optimization-settings)))
          ,@(when settings `((proclaim `(optimize ,@,settings))))
          (unwind-protect (progn ,@body)
            (proclaim `(optimize ,@,previous-settings)))))
-    #-clisp
+    #-(or allegro clisp)
     `(let ,(loop :for v :in +optimization-variables+ :collect `(,v ,v))
        ,@(when settings `((proclaim `(optimize ,@,settings))))
        ,@body)))