From acd0c076aa17e7b799f6079529afba045b138b61 Mon Sep 17 00:00:00 2001 From: "Peter S. Housel" Date: Fri, 28 Jun 2024 21:49:52 -0700 Subject: [PATCH 1/3] dfmc-flow-graph: Properly maintain loop merge bookkeeping * sources/dfmc/flow-graph/utilities.dylan (delete-computation! on ): Override to properly remove dead loop merges from the auxiliary collections kept within and nodes. --- sources/dfmc/flow-graph/utilities.dylan | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sources/dfmc/flow-graph/utilities.dylan b/sources/dfmc/flow-graph/utilities.dylan index 7b75616b9f..f7569c78eb 100644 --- a/sources/dfmc/flow-graph/utilities.dylan +++ b/sources/dfmc/flow-graph/utilities.dylan @@ -436,6 +436,14 @@ define method delete-computation! (c :: ) => (); remove-computation-references!(c); end method; +define method delete-computation! (c :: ) => (); + let loop :: = c.loop-merge-loop; + loop.loop-merges := remove!(loop.loop-merges, c); + let loop-call :: = c.loop-merge-call; + loop-call.loop-call-merges := remove!(loop-call.loop-call-merges, c); + next-method(); +end method; + //// multiple computation interfaces define method insert-computations-after! From 2b11414374ecb17bc8b6712982081b9531dd8851 Mon Sep 17 00:00:00 2001 From: "Peter S. Housel" Date: Fri, 28 Jun 2024 23:04:40 -0700 Subject: [PATCH 2/3] dylan-test-suite: Add a test for issue 1523 This adds a regression test for issue 1523, a compilation failure that occurrs when loop merges are deleted as dead code. * sources/dylan/tests/regressions.dylan (test issue-1523): New test with a loop merge eligible for deletion. --- sources/dylan/tests/regressions.dylan | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sources/dylan/tests/regressions.dylan b/sources/dylan/tests/regressions.dylan index c95cde3c19..d985d9b540 100644 --- a/sources/dylan/tests/regressions.dylan +++ b/sources/dylan/tests/regressions.dylan @@ -276,6 +276,20 @@ define test issue-1455 () check-true("no other values were returned", empty?(more)); end; +define test issue-1523 () + // Loop merge for a can be eliminated as dead code + let value + = iterate loop (a = #f, b = 1) + if (b == 3) + b + else + loop(b, b + 1) + end + end; + check-equal("Loop with dead iteration variables executes properly", + value, 3); +end; + define suite dylan-regressions-test-suite () test bug-2766; test bug-5800; @@ -299,4 +313,5 @@ define suite dylan-regressions-test-suite () test issue-1091; test issue-1095; test issue-1455; + test issue-1523; end suite; From f05ba9e551bd70ccea04e434cc5fb2ea2474ec51 Mon Sep 17 00:00:00 2001 From: "Peter S. Housel" Date: Sat, 29 Jun 2024 11:00:48 -0700 Subject: [PATCH 3/3] release-notes: Add entry for issue 1523 fix --- documentation/source/release-notes/2024.2.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/documentation/source/release-notes/2024.2.rst b/documentation/source/release-notes/2024.2.rst index c9562928ee..9f43db4161 100644 --- a/documentation/source/release-notes/2024.2.rst +++ b/documentation/source/release-notes/2024.2.rst @@ -39,6 +39,9 @@ Compiler the comparison can now be properly inlined because the first argument to :drm:`min` is known to be an :drm:``. +* `Issue 1523 `_, which + could result in a compiler abort during code generation, has been fixed. + Tools =====