summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-11-27 18:01:23 +0000
committerAlasdair Armstrong2018-11-27 21:43:19 +0000
commit6b67c91583da5eedc02a3942ef864d1fd64a48aa (patch)
tree1d20576fa7ffd62a9cbff7f95b8084effa48cfb2 /test
parentd48ccd801b4d99c160f289b2efdde10aa36e7bdd (diff)
Add an optimisation pass to combine variables if possible
This optimisation re-uses variables if possible, rather than allocating new ones.
Diffstat (limited to 'test')
-rw-r--r--test/c/non_unique.expect1
-rw-r--r--test/c/non_unique.sail20
2 files changed, 21 insertions, 0 deletions
diff --git a/test/c/non_unique.expect b/test/c/non_unique.expect
new file mode 100644
index 00000000..9766475a
--- /dev/null
+++ b/test/c/non_unique.expect
@@ -0,0 +1 @@
+ok
diff --git a/test/c/non_unique.sail b/test/c/non_unique.sail
new file mode 100644
index 00000000..eda7720d
--- /dev/null
+++ b/test/c/non_unique.sail
@@ -0,0 +1,20 @@
+default Order dec
+
+$include <prelude.sail>
+
+val "print_endline" : string -> unit
+
+function f(_: int) -> unit = ()
+function g(_: bits(1)) -> unit = ()
+
+function main(() : unit) -> unit = {
+ let y : int = {
+ let x : int = 3;
+ x
+ };
+ {
+ let x : bits(1) = 0b0;
+ g(x)
+ };
+ print_endline("ok");
+} \ No newline at end of file