Mercury Bugs - mercury
View Issue Details
0000509mercuryBugpublic2020-06-16 02:472020-06-16 02:47
Reporterzs 
Assigned Tozs 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusassignedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000509: higher_order.m optimizes soon-to-be-dead procedures
DescriptionWhen the compiler has read in a bunch of predicate/function definitions from .opt files,
those definitions get added to set of valid preds. higher_order.m looks for optimization
opportunities among the set of valid preds. However, the common case is that
those .opt files contain a whole bunch of predicates of which the current module
uses only a few either directly or indirectly. (When have you written any module
that calls all or even most of the predicates exported from e.g. list.m or map.m?)
Optimizing the predicates that one of the following compiler passes will soon delete
as dead code is a performance bug.

We should modify either higher_order.m or its caller to delete dead procedures
from the HLDS before it starts its work.

Note that we will still need to do a round of dead proc elimination *after* higher_order.m,
since higher_order.m can sometimes replace all calls to a predicate with calls to a
specialized version, which makes the original version obsolete. However, maybe
this could be done by higher_order.m itself *faster* than dead_proc_elim.m could
do it, since it should be possible to avoid the need to construct a full call graph
to do the job; counting unspecialized call sites should do the job.
TagsNo tags attached.
Attached Files

There are no notes attached to this issue.

Issue History
2020-06-16 02:47zsNew Issue
2020-06-16 02:47zsStatusnew => assigned
2020-06-16 02:47zsAssigned To => zs