Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loop merge bookkeeping #1622

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions documentation/source/release-notes/2024.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:`<integer>`.

* `Issue 1523 <https://github.com/dylan-lang/opendylan/issues/1523>`_, which
could result in a compiler abort during code generation, has been fixed.

Tools
=====

Expand Down
8 changes: 8 additions & 0 deletions sources/dfmc/flow-graph/utilities.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,14 @@ define method delete-computation! (c :: <unwind-protect>) => ();
remove-computation-references!(c);
end method;

define method delete-computation! (c :: <loop-merge>) => ();
let loop :: <loop> = c.loop-merge-loop;
loop.loop-merges := remove!(loop.loop-merges, c);
let loop-call :: <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!
Expand Down
15 changes: 15 additions & 0 deletions sources/dylan/tests/regressions.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -299,4 +313,5 @@ define suite dylan-regressions-test-suite ()
test issue-1091;
test issue-1095;
test issue-1455;
test issue-1523;
end suite;