diff options
author | Björn Gustavsson <[email protected]> | 2017-09-01 10:44:41 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-09-01 10:44:41 +0200 |
commit | 2ddc4f3808e9139ca9826c04d0f2829d3bf50b84 (patch) | |
tree | e9d266d04a55f0511ed98dd0cb9b2c9844879a5a /lib/compiler/src | |
parent | 2d32a4d56c2e2bf9aeb3593efca5a2f9d8419d97 (diff) | |
parent | 00c13ed24a08799ba938a64e3198e75f07329486 (diff) | |
download | otp-2ddc4f3808e9139ca9826c04d0f2829d3bf50b84.tar.gz otp-2ddc4f3808e9139ca9826c04d0f2829d3bf50b84.tar.bz2 otp-2ddc4f3808e9139ca9826c04d0f2829d3bf50b84.zip |
Merge pull request #1554 from bjorng/bjorn/compiler/opt-bsm/ERL-444
Eliminate unnecessary 'move' instructions
OTP-14594
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/v3_codegen.erl | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/compiler/src/v3_codegen.erl b/lib/compiler/src/v3_codegen.erl index 47c1567f10..0ae3289103 100644 --- a/lib/compiler/src/v3_codegen.erl +++ b/lib/compiler/src/v3_codegen.erl @@ -884,12 +884,19 @@ select_extract_bin([{var,Hd}], Size, Unit, binary, Flags, Vf, %% calculcated by v3_life is too conservative to be useful for this purpose.) %% 'true' means that the code that follows will definitely not use the context %% again (because it is a block, not guard or matching code); 'false' that we -%% are not sure (there is either a guard, or more matching, either which may -%% reference the context again). - -is_context_unused(#l{ke=Ke}) -> is_context_unused(Ke); -is_context_unused({block,_}) -> true; -is_context_unused(_) -> false. +%% are not sure (there could be more matching). + +is_context_unused(#l{ke=Ke}) -> + is_context_unused(Ke); +is_context_unused({alt,_First,Then}) -> + %% {alt,First,Then} can be used for different purposes. If the Then part + %% is a block, it means that matching has finished and is used for a guard + %% to choose between the matched clauses. + is_context_unused(Then); +is_context_unused({block,_}) -> + true; +is_context_unused(_) -> + false. select_bin_end(#l{ke={val_clause,{bin_end,Ctx},B}}, Ivar, Tf, Bef, St0) -> |