Skip to content

Commit

Permalink
Merge loop-merge fix to master (#1623)
Browse files Browse the repository at this point in the history
  • Loading branch information
housel authored Jul 1, 2024
2 parents e4e7d91 + ba2348e commit 69c27e4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
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;

0 comments on commit 69c27e4

Please sign in to comment.