Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HiPE: Add optimisation that eliminates redundant maps:is_key/2 calls #1069

Merged
merged 2 commits into from
May 26, 2016

Conversation

margnus1
Copy link
Contributor

HiPE uses the built-in functions from the maps module to implement the map syntax. With the addition of more sophisticated map types in the erl_types type system, HiPE can sometimes conclude at compile time what the result of calls to maps:is_key/2 will be, but is unable to eliminate the call since the type system does not express freedom from side effects. This patch adds an optimisation pass that hard-codes BIFs that are side-effect free under certain conditions and eliminates calls to them when their results are known.

The optimisation is written to be easily extensible to eliminate more BIFs.

margnus1 and others added 2 commits May 23, 2016 17:09
 * Implemented removal of maps:is_key/2 calls of which the result is
   known in a new pass during the typed phase, called
   hipe_icode_call_elim.
 * Added the option icode_call_elim that enables the
   hipe_icode_call_elim pass, and made it default for o2.
 * Added a suite opt_verify_SUITE.erl to HiPE that tests for the results
   of optimisations, with a single testcase that checks that the
   icode_call_elim optimisation pass does remove calls to maps:is_key/2
   where sound and not otherwise.
 * Made hipe_testsuite_driver only create explicitly listed suites.
@bjorng bjorng added team:VM Assigned to OTP team VM and removed team:MW labels May 25, 2016
@psyeugenic psyeugenic merged commit f833a90 into erlang:master May 26, 2016
@margnus1 margnus1 deleted the hipe-map-opts branch May 26, 2016 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants