From 3993e7473a1a7eba4181c8cc6e16255d76b8bf52 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 28 Jul 2023 18:38:49 -0700 Subject: compiler: use partition-if for basic block division. * stdlib/optimize.tl (basic-blocks :postinit): Calculate the basic block partitions more directly using partition-if, eliminating the calculation of two sequences of indices that have to be merged and then passed to the partition function. --- stdlib/optimize.tl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'stdlib') diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl index 908b7e0d..3ca7f07c 100644 --- a/stdlib/optimize.tl +++ b/stdlib/optimize.tl @@ -74,11 +74,11 @@ (:postinit (bb) (let* ((insns (early-peephole (dedup-labels (cons bb.start bb.insns)))) - (cuts (merge [where symbolp insns] - [where [andf consp - (op memq (car @1) bb.jump-ops)] - (cons nil insns)])) - (parts (partition insns cuts)) + (parts (partition-if (lambda (prev next) + (or (symbolp next) + (and (consp prev) + (memq (car prev) bb.jump-ops)))) + insns)) (lparts (mapcar [iff [chain car symbolp] use (op cons (gensym))] -- cgit v1.2.3