-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flambda-backend: Properly handle regions around recursive definitions (…
…#2601) * Properly handle regions around recursive definitions * Update tests: add reference output and original minimal example
- Loading branch information
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(* TEST *) | ||
|
||
(* Recursive values are not allowed to be stack-allocated, but their | ||
defining expressions are allowed to make allocations on the stack. | ||
This can introduce a region around the whole definition. *) | ||
|
||
let rec f = | ||
let p = local_ (fun msg -> print_string msg) in | ||
p "hello, "; | ||
p "world!"; | ||
print_newline (); | ||
fun x -> f x | ||
|
||
(* Original bug report: unused function *) | ||
let rec foo = | ||
let _f x = x, foo in | ||
function | ||
| None -> foo None | ||
| Some x -> x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello, world! |