1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

enable cse

* module/language/tree-il/optimize.scm: Enable CSE unless #:cse? #f is
  passed.

* test-suite/tests/tree-il.test: Disable CSE for one test.
This commit is contained in:
Andy Wingo 2012-04-13 15:23:20 -07:00
parent f66cbb99ee
commit 9068f4f527
2 changed files with 13 additions and 5 deletions

View file

@ -1,6 +1,6 @@
;;; Tree-il optimizer ;;; Tree-il optimizer
;; Copyright (C) 2009, 2011 Free Software Foundation, Inc. ;; Copyright (C) 2009, 2011, 2012 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or ;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public ;;;; modify it under the terms of the GNU Lesser General Public
@ -22,6 +22,7 @@
#:use-module (language tree-il) #:use-module (language tree-il)
#:use-module (language tree-il primitives) #:use-module (language tree-il primitives)
#:use-module (language tree-il peval) #:use-module (language tree-il peval)
#:use-module (language tree-il cse)
#:use-module (language tree-il fix-letrec) #:use-module (language tree-il fix-letrec)
#:use-module (language tree-il debug) #:use-module (language tree-il debug)
#:use-module (ice-9 match) #:use-module (ice-9 match)
@ -32,8 +33,15 @@
((#:partial-eval? #f _ ...) ((#:partial-eval? #f _ ...)
;; Disable partial evaluation. ;; Disable partial evaluation.
(lambda (x e) x)) (lambda (x e) x))
(_ peval)))) (_ peval)))
(cse (match (memq #:cse? opts)
((#:cse? #f _ ...)
;; Disable CSE.
(lambda (x) x))
(_ cse))))
(fix-letrec! (fix-letrec!
(verify-tree-il (verify-tree-il
(peval (expand-primitives! (resolve-primitives! x env)) (cse
env))))) (verify-tree-il
(peval (expand-primitives! (resolve-primitives! x env))
env)))))))

View file

@ -148,7 +148,7 @@
(lexical #t #f ref 0) (call return 1) (lexical #t #f ref 0) (call return 1)
(unbind))) (unbind)))
(assert-tree-il->glil without-partial-evaluation (assert-tree-il->glil with-options (#:partial-eval? #f #:cse? #f)
(let (x) (y) ((const 1)) (begin (lexical x y) (const #f))) (let (x) (y) ((const 1)) (begin (lexical x y) (const #f)))
(program () (std-prelude 0 1 #f) (label _) (program () (std-prelude 0 1 #f) (label _)
(const 1) (bind (x #f 0)) (lexical #t #f set 0) (const 1) (bind (x #f 0)) (lexical #t #f set 0)