diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 9feea34ac9e..ce2d8ac47c4 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1179,14 +1179,6 @@ See Info node `(elisp) Integer Basics'." form ; No improvement. (cons 'concat (nreverse newargs))))) -(defun byte-optimize-string-greaterp (form) - ;; Rewrite in terms of `string-lessp' which has its own bytecode. - (pcase (cdr form) - (`(,a ,b) (let ((arg1 (make-symbol "arg1"))) - `(let ((,arg1 ,a)) - (string-lessp ,b ,arg1)))) - (_ form))) - (put 'identity 'byte-optimizer #'byte-optimize-identity) (put 'memq 'byte-optimizer #'byte-optimize-memq) (put 'memql 'byte-optimizer #'byte-optimize-member) @@ -1214,8 +1206,6 @@ See Info node `(elisp) Integer Basics'." (put '> 'byte-optimizer #'byte-opt--nary-comparison) (put '>= 'byte-optimizer #'byte-opt--nary-comparison) -(put 'string-greaterp 'byte-optimizer #'byte-optimize-string-greaterp) - (put 'concat 'byte-optimizer #'byte-optimize-concat) ;; I'm not convinced that this is necessary. Doesn't the optimizer loop diff --git a/lisp/subr.el b/lisp/subr.el index 466b4791c06..e29f0930b93 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6222,7 +6222,10 @@ consisting of STR followed by an invisible left-to-right mark "Return non-nil if STRING1 is greater than STRING2 in lexicographic order. Case is significant. Symbols are also allowed; their print names are used instead." - (declare (pure t) (side-effect-free t)) + (declare (compiler-macro (lambda (_) + (let ((arg1 (make-symbol "arg1"))) + `(let ((,arg1 ,string1)) + (string-lessp ,string2 ,arg1)))))) (string-lessp string2 string1))