emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp eafcc8e 4/6: Propagate function calls also when hidd


From: Andrea Corallo
Subject: feature/native-comp eafcc8e 4/6: Propagate function calls also when hiddend under funcall
Date: Mon, 28 Dec 2020 10:33:15 -0500 (EST)

branch: feature/native-comp
commit eafcc8eda0a78e78d1a53b30dafb22786dd60591
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    Propagate function calls also when hiddend under funcall
    
        * lisp/emacs-lisp/comp.el (comp-fwprop-call): Propagate functions
        also when called under `funcall'.
        * test/src/comp-tests.el (comp-tests-type-spec-tests): Add a test.
---
 lisp/emacs-lisp/comp.el | 4 ++++
 test/src/comp-tests.el  | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index c6bd040..2ca7c50 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2642,6 +2642,10 @@ Return non-nil if the function is folded successfully."
 F is the function being called with arguments ARGS.
 Fold the call in case."
   (unless (comp-function-call-maybe-fold insn f args)
+    (when (and (eq 'funcall f)
+               (comp-mvar-value-vld-p (car args)))
+      (setf f (comp-mvar-value (car args))
+            args (cdr args)))
     (when-let ((cstr-f (gethash f comp-known-func-cstr-h)))
       (let ((cstr (comp-cstr-f-ret cstr-f)))
         (setf (comp-mvar-range lval) (comp-cstr-range cstr)
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index dbfa370..d4eb39a 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -1137,7 +1137,12 @@ Return a list of results."
       ((defun comp-tests-ret-type-spec-f (x)
          (when (<= 1 x 5)
            (1- x)))
-       (or null float (integer 0 4)))))
+       (or null float (integer 0 4)))
+
+      ;; 47
+      ((defun comp-tests-ret-type-spec-f ()
+         (error "foo"))
+       nil)))
 
   (defun comp-tests-define-type-spec-test (number x)
     `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]