From 1bb44a1ad634c20046cd3de7fc41a1102be842a9 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 7 Jan 2018 13:00:31 +0100 Subject: [PATCH] Minor optimization in loop peeling * module/language/cps/peel-loops.scm (compute-out-vars): Fold over the body of the loop, not the body of the function. A small optimization. --- module/language/cps/peel-loops.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/language/cps/peel-loops.scm b/module/language/cps/peel-loops.scm index ec5cb5f25..43e986935 100644 --- a/module/language/cps/peel-loops.scm +++ b/module/language/cps/peel-loops.scm @@ -126,13 +126,13 @@ (let ((live (compute-live-variables cps entry body succs))) (intset-fold-right cons - (intmap-fold (lambda (label succs live-out) - (if (intset-ref succs exit) + (intset-fold (lambda (label live-out) + (if (intset-ref (intmap-ref succs label) exit) (if live-out (intset-intersect live-out (intmap-ref live label)) (intmap-ref live label)) live-out)) - succs #f) + body #f) '()))) (define (rename-cont cont fresh-labels fresh-vars)