diff options
author | Björn Gustavsson <[email protected]> | 2018-01-22 11:47:03 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-01-24 05:49:35 +0100 |
commit | d5fbb64374247af0a90974a9c37a3eba93774f28 (patch) | |
tree | 9013252abf04723e12b33224bae200b72c483757 /lib/compiler/src | |
parent | ab6ac37e0c40331a2debd90f753ec2f4531e4701 (diff) | |
download | otp-d5fbb64374247af0a90974a9c37a3eba93774f28.tar.gz otp-d5fbb64374247af0a90974a9c37a3eba93774f28.tar.bz2 otp-d5fbb64374247af0a90974a9c37a3eba93774f28.zip |
Correct bug in beam_block:opt/2
The folling sequence in a block:
{move,{x,1},{x,2}}.
{move,{x,2},{x,2}}.
would be incorrectly rewritten to:
{move,{x,2},{x,2}}.
(Which in turn would be optimized away a little bit later.)
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/beam_block.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_block.erl b/lib/compiler/src/beam_block.erl index 7f6d3a75ae..18f325f172 100644 --- a/lib/compiler/src/beam_block.erl +++ b/lib/compiler/src/beam_block.erl @@ -231,7 +231,7 @@ alloc_may_pass({set,_,_,_}) -> true. %% Optimize the instruction stream inside a basic block. opt([{set,[X],[X],move}|Is]) -> opt(Is); -opt([{set,[X],_,move},{set,[X],_,move}=I|Is]) -> +opt([{set,[Dst],_,move},{set,[Dst],[Src],move}=I|Is]) when Dst =/= Src -> opt([I|Is]); opt([{set,[{x,0}],[S1],move}=I1,{set,[D2],[{x,0}],move}|Is]) -> opt([I1,{set,[D2],[S1],move}|Is]); |