aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/beam_type_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-09-23 12:30:16 +0200
committerBjörn Gustavsson <[email protected]>2015-09-28 10:26:40 +0200
commitb66193afc3fe85072da4631c52c5ccec136caa05 (patch)
tree18fa64027bd9b301c7df8f8d2badefb0ad1e66fc /lib/compiler/test/beam_type_SUITE.erl
parentc0c5943c3a2646a3383d974c2a1afcff8c5d16d3 (diff)
downloadotp-b66193afc3fe85072da4631c52c5ccec136caa05.tar.gz
otp-b66193afc3fe85072da4631c52c5ccec136caa05.tar.bz2
otp-b66193afc3fe85072da4631c52c5ccec136caa05.zip
beam_type: Improve optimizations by keeping track of booleans
There is an optimization in beam_block to simplify a select_val on a known boolean value. We can implement this optimization in a cleaner way in beam_type and it will also be applicable in more situations. (When I added the optimization to beam_type without removing the optimization from beam_block, the optimization was applied 66 times.)
Diffstat (limited to 'lib/compiler/test/beam_type_SUITE.erl')
-rw-r--r--lib/compiler/test/beam_type_SUITE.erl15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/compiler/test/beam_type_SUITE.erl b/lib/compiler/test/beam_type_SUITE.erl
index 8d99d76180..8d5c0190ed 100644
--- a/lib/compiler/test/beam_type_SUITE.erl
+++ b/lib/compiler/test/beam_type_SUITE.erl
@@ -21,7 +21,7 @@
-export([all/0,suite/0,groups/0,init_per_suite/1,end_per_suite/1,
init_per_group/2,end_per_group/2,
- integers/1,coverage/1]).
+ integers/1,coverage/1,booleans/1]).
suite() -> [{ct_hooks,[ts_install_cth]}].
@@ -32,7 +32,8 @@ all() ->
groups() ->
[{p,[parallel],
[integers,
- coverage
+ coverage,
+ booleans
]}].
init_per_suite(Config) ->
@@ -83,5 +84,15 @@ coverage(_Config) ->
ok.
+booleans(_Config) ->
+ {'EXIT',{{case_clause,_},_}} = (catch do_booleans(42)),
+ ok.
+
+do_booleans(B) ->
+ case is_integer(B) of
+ yes -> yes;
+ no -> no
+ end.
+
id(I) ->
I.