diff options
author | Björn Gustavsson <[email protected]> | 2018-08-21 08:58:15 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-09-17 06:41:02 +0200 |
commit | 70bb14fe3fd27e8c429bf402e364b144a5807d9a (patch) | |
tree | c8c86337d5324e900ce483eb49b32227a3a314d2 /lib/compiler/test/core_fold_SUITE.erl | |
parent | ec1f35c9f52be894ba295b9a48237020855e3c46 (diff) | |
download | otp-70bb14fe3fd27e8c429bf402e364b144a5807d9a.tar.gz otp-70bb14fe3fd27e8c429bf402e364b144a5807d9a.tar.bz2 otp-70bb14fe3fd27e8c429bf402e364b144a5807d9a.zip |
Add beam_ssa_dead.erl
Add beam_ssa_dead to perform the main optimizations done
by beam_dead:
* Shortcut branches that jump to another block with a branch.
If it can be seen that the second branch will always branch
to a specific block, replace the target of the first branch.
* Combined nested sequences of '=:=' tests and switch
instructions operating on the same variable to a single switch.
Diffing the compiler output, it seems that beam_ssa_dead finds
many more opportunities for optimizations than beam_dead,
although it does not find all opportunities that beam_dead does.
In total, beam_ssa_dead is such improvement over beam_dead that
there is no reason to keep beam_dead as well as beam_ssa_dead.
Note that beam_ssa_dead does not attempt to optimize away
redundant bs_context_binary instructions, because that instruction
will be superseded by new instructions in the near future.
Diffstat (limited to 'lib/compiler/test/core_fold_SUITE.erl')
-rw-r--r-- | lib/compiler/test/core_fold_SUITE.erl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/compiler/test/core_fold_SUITE.erl b/lib/compiler/test/core_fold_SUITE.erl index 68bc5c6e2f..3fca1434ae 100644 --- a/lib/compiler/test/core_fold_SUITE.erl +++ b/lib/compiler/test/core_fold_SUITE.erl @@ -212,9 +212,14 @@ bifs(Config) when is_list(Config) -> {ok,#{K:=V}} = id(list_to_tuple([ok,#{K=>V}])), ok. --define(CMP_SAME(A0, B), (fun(A) -> true = A == B, false = A /= B end)(id(A0))). --define(CMP_DIFF(A0, B), (fun(A) -> false = A == B, true = A /= B end)(id(A0))). - +-define(CMP_SAME0(A0, B), (fun(A) -> true = A == B, false = A /= B end)(id(A0))). +-define(CMP_SAME1(A0, B), (fun(A) -> false = A /= B, true = A == B end)(id(A0))). +-define(CMP_SAME(A0, B), (true = ?CMP_SAME0(A0, B) =:= not ?CMP_SAME1(A0, B))). + +-define(CMP_DIFF0(A0, B), (fun(A) -> false = A == B, true = A /= B end)(id(A0))). +-define(CMP_DIFF1(A0, B), (fun(A) -> true = A /= B, false = A == B end)(id(A0))). +-define(CMP_DIFF(A0, B), (true = ?CMP_DIFF0(A0, B) =:= not ?CMP_DIFF1(A0, B))). + eq(Config) when is_list(Config) -> ?CMP_SAME([a,b,c], [a,b,c]), ?CMP_SAME([42.0], [42.0]), |