aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-09-15 16:50:19 +0200
committerBjörn Gustavsson <[email protected]>2015-09-28 10:26:39 +0200
commitf7fd259f27bce0058d996af6287e6bb81d12ea47 (patch)
treeab65c3b4e85df0cc8e70b0ab97b7dcd84754ecd9
parent9504c0dd71d0b1b49251a97f45c71c8882ce7708 (diff)
downloadotp-f7fd259f27bce0058d996af6287e6bb81d12ea47.tar.gz
otp-f7fd259f27bce0058d996af6287e6bb81d12ea47.tar.bz2
otp-f7fd259f27bce0058d996af6287e6bb81d12ea47.zip
sys_core_fold: Extend the list of BIFs that return integers
Knowing that a BIF returns an integer makes it possible to replace '==' with the cheaper '=:=' test.
-rw-r--r--lib/compiler/src/sys_core_fold.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl
index 27d023d067..0a16776bd4 100644
--- a/lib/compiler/src/sys_core_fold.erl
+++ b/lib/compiler/src/sys_core_fold.erl
@@ -2793,12 +2793,18 @@ extract_type_1(Expr, Sub) ->
true -> bool
end.
+returns_integer('band', [_,_]) -> true;
+returns_integer('bnot', [_]) -> true;
+returns_integer('bor', [_,_]) -> true;
+returns_integer('bxor', [_,_]) -> true;
returns_integer(bit_size, [_]) -> true;
returns_integer('bsl', [_,_]) -> true;
returns_integer('bsr', [_,_]) -> true;
returns_integer(byte_size, [_]) -> true;
+returns_integer('div', [_,_]) -> true;
returns_integer(length, [_]) -> true;
returns_integer('rem', [_,_]) -> true;
+returns_integer('round', [_]) -> true;
returns_integer(size, [_]) -> true;
returns_integer(tuple_size, [_]) -> true;
returns_integer(trunc, [_]) -> true;