Subject: 30.0.50; native compilation: type optimization does not always work for `lisp' return value

From: Ihor Radchenko <[email-masked]>
Date: Fri, 25 Aug 2023 10:55:22 +0000

X-Debbugs-CC: [email-masked]

Hi,

Following up https://yhetil.org/emacs-devel/[email-masked]

When we have

(defun test1 ()
  (let ((x (list 'a 'b 'c)))
    (when (listp x) "Return value")))

native compilation, fails to optimize away the `listp' return value
despite it is known that x is a list at compile time.

In GNU Emacs 30.0.50 (build 58, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-08-24 built on localhost
Repository revision: 476db65dc780d8c501d73dfaaf92c53eb9c73b2f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Gentoo Linux

Configured using:
 'configure --with-native-compilation
 JAVAC=/etc/java-config-2/current-system-vm/bin/javac'

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>