diff options
author | Björn Gustavsson <[email protected]> | 2015-01-23 13:12:09 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-02-03 09:39:32 +0100 |
commit | 4babd738633953a09ce3314ed89d0933063b4ef7 (patch) | |
tree | 4975109d3d64e76fdc4ba5a7e7e3ecdef586ef11 /lib/compiler/test/test_lib.erl | |
parent | cd1eaf0116190ab72f3a792b74be99eda5dd31eb (diff) | |
download | otp-4babd738633953a09ce3314ed89d0933063b4ef7.tar.gz otp-4babd738633953a09ce3314ed89d0933063b4ef7.tar.bz2 otp-4babd738633953a09ce3314ed89d0933063b4ef7.zip |
Teach case_opt/3 to avoid unnecessary building
Given this code:
f(S) ->
F0 = F1 = {S,S},
[F0,F1].
case_opt/3 would "optimize" it like this:
f(S) ->
F1 = {S,S},
F0 = {S,S},
[F0,F1].
Similarly, this code:
g({a,_,_}=T) ->
{b,
[_,_] = [T,none],
x}.
would be rewritten to:
g({a,Tmp1,Tmp2}=T) ->
Tmp3 = {a,Tmp1,Tmp2},
{b,
[Tmp3,none],
x}.
where the tuple is rebuilt instead of using the T variable.
Rewrite case_opt/3 to be more careful while optimizing.
Diffstat (limited to 'lib/compiler/test/test_lib.erl')
-rw-r--r-- | lib/compiler/test/test_lib.erl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/compiler/test/test_lib.erl b/lib/compiler/test/test_lib.erl index e06e42276a..e8f469c5b4 100644 --- a/lib/compiler/test/test_lib.erl +++ b/lib/compiler/test/test_lib.erl @@ -20,9 +20,11 @@ -include("test_server.hrl"). -compile({no_auto_import,[binary_part/2]}). --export([recompile/1,parallel/0,uniq/0,opt_opts/1,get_data_dir/1, +-export([id/1,recompile/1,parallel/0,uniq/0,opt_opts/1,get_data_dir/1, smoke_disasm/1,p_run/2,binary_part/2]). +id(I) -> I. + recompile(Mod) when is_atom(Mod) -> case whereis(cover_server) of undefined -> ok; |