[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp e6ab4e3 04/14: * Add a test targeting forward propag
From: |
Andrea Corallo |
Subject: |
feature/native-comp e6ab4e3 04/14: * Add a test targeting forward propagation |
Date: |
Thu, 9 Jul 2020 11:57:51 -0400 (EDT) |
branch: feature/native-comp
commit e6ab4e3dfe2bfc6e935b4cfa7e8f686e5d926235
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Add a test targeting forward propagation
* test/src/comp-tests.el (comp-tests-fw-prop-checker-1): New
function.
(comp-tests-fw-prop): New test.
---
test/src/comp-tests.el | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index aefb2f0..332facb 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -640,4 +640,26 @@ CHECKER should always return nil to have a pass."
(should (subr-native-elisp-p (symbol-function #'comp-tests-tco-f)))
(should (= (comp-tests-tco-f 1 0 10) 55))))
+(defun comp-tests-fw-prop-checker-1 (_)
+ "Check that inside `comp-tests-fw-prop-f' `concat' and `length' are folded."
+ (comp-tests-make-insn-checker
+ 'comp-tests-fw-prop-1-f
+ (lambda (insn)
+ (or (comp-tests-mentioned-p 'concat insn)
+ (comp-tests-mentioned-p 'length insn)))))
+
+(ert-deftest comp-tests-fw-prop ()
+ "Some tests for forward propagation."
+ (let ((comp-speed 2)
+ (comp-post-pass-hooks '((comp-final comp-tests-fw-prop-checker-1))))
+ (eval '(defun comp-tests-fw-prop-1-f ()
+ (let* ((a "xxx")
+ (b "yyy")
+ (c (concat a b))) ; <= has to optimize
+ (length c))) ; <= has to optimize
+ t)
+ (load (native-compile #'comp-tests-fw-prop-1-f))
+ (should (subr-native-elisp-p (symbol-function #'comp-tests-fw-prop-1-f)))
+ (should (= (comp-tests-fw-prop-1-f) 6))))
+
;;; comp-tests.el ends here
- feature/native-comp updated (2593bbe -> 5f13016), Andrea Corallo, 2020/07/09
- feature/native-comp 0b81044 02/14: * Clean-up some const folding logic and add `comp-function-pure-p', Andrea Corallo, 2020/07/09
- feature/native-comp b31b0eb 03/14: * Rework some test logic for generality, Andrea Corallo, 2020/07/09
- feature/native-comp 3d43d45 01/14: Merge remote-tracking branch 'savannah/master' into HEAD, Andrea Corallo, 2020/07/09
- feature/native-comp 4348969 06/14: * test/src/comp-test-funcs.el (comp-tests-aref-aset-f) : Fix UB., Andrea Corallo, 2020/07/09
- feature/native-comp 5688739 07/14: * Add `comp-call-op-p', Andrea Corallo, 2020/07/09
- feature/native-comp 9aaca82 12/14: * Add `comp-disabled-passes', Andrea Corallo, 2020/07/09
- feature/native-comp e6ab4e3 04/14: * Add a test targeting forward propagation,
Andrea Corallo <=
- feature/native-comp 3db6ace 05/14: * Define `comp-symbol-func-to-fun', Andrea Corallo, 2020/07/09
- feature/native-comp 7622740 08/14: * Introduce a new pass ipa-pure, Andrea Corallo, 2020/07/09
- feature/native-comp b4de6ba 09/14: * Optimize pure functions defined by the compilation environment, Andrea Corallo, 2020/07/09
- feature/native-comp 5f13016 14/14: Merge remote-tracking branch 'savannah/master' into wip2, Andrea Corallo, 2020/07/09
- feature/native-comp a53b446 10/14: Add some tests for pure function optimization, Andrea Corallo, 2020/07/09
- feature/native-comp 92e744d 11/14: ; * test/src/comp-test-funcs-dyn.el: Fix comment header., Andrea Corallo, 2020/07/09
- feature/native-comp 02bf2e0 13/14: * Disable ipa-pure in comp-tests-tco, Andrea Corallo, 2020/07/09