From 22c4d282aae4279b37bd3d031b3baade2a3e508b Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 12 Jan 2018 16:14:59 +0100 Subject: Only substitute if all referenced variables are in scope. --- test/libjulia/Rematerialiser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/libjulia') diff --git a/test/libjulia/Rematerialiser.cpp b/test/libjulia/Rematerialiser.cpp index ae254ad9..020f0020 100644 --- a/test/libjulia/Rematerialiser.cpp +++ b/test/libjulia/Rematerialiser.cpp @@ -126,4 +126,13 @@ BOOST_AUTO_TEST_CASE(reassignment) ); } +BOOST_AUTO_TEST_CASE(do_not_move_out_of_scope) +{ + // Cannot replace by `let b := x` by `let b := a` since a is out of scope. + CHECK( + "{ let x { let a := sload(0) x := a } let b := x }", + "{ let x { let a := sload(0) x := a } let b := x }" + ); +} + BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.3