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/bs_match_SUITE.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/bs_match_SUITE.erl')
0 files changed, 0 insertions, 0 deletions