[m-rev.] for review: dead_pred_elim optimization
Peter Ross
pro at missioncriticalit.com
Thu Mar 6 22:11:57 AEDT 2003
On Thu, Mar 06, 2003 at 08:39:58PM +1100, Simon Taylor wrote:
> On 06-Mar-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> > On Thu, Mar 06, 2003 at 04:17:37PM +1100, Simon Taylor wrote:
> > > On 05-Mar-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> > > > Estimated hours taken: 4
> > > > Branches: main
> > > >
> > > > Fix a performance bug where dead_pred_elim was taking a significant
> > > > amount of time to delete entries from the predicate_table. With this
> > > > change dead_pred_elim goes from 12 minutes to 55 seconds CPU time in
> > > > the IL grade when compiling accumulator.m with
> > > > --intermodule-optimization turned on.
>
> Is that 55 seconds for the entire compilation or just for
> dead_pred_elim?
>
Just for the dead_pred_elim.
> > > > Index: compiler/hlds_module.m
> > > > ===================================================================
> > > > @@ -1756,22 +1765,45 @@
> > > >
> > > > %-----------------------------------------------------------------------------%
> > > >
> > > > +predicate_table_restrict(OrigPredicateTable, PredIds, PredicateTable) :-
> > > > + predicate_table_reset(OrigPredicateTable, PredicateTable0),
> > > > + predicate_table_get_preds(OrigPredicateTable, Preds),
> > > > + PredicateTable = list__foldl(
> > > > + (func(PredId, Table0) = Table :-
> > > > + PredInfo = map__lookup(Preds, PredId),
> > > > + predicate_table_insert_2(Table0,
> > > > + yes(PredId), PredInfo,
> > > > + must_be_qualified,
> > > > + no, _, Table)
> > > > +
> > > > + ), PredIds, PredicateTable0).
> > >
> > > The `must_be_qualified' here looks wrong.
> > >
> > On second thoughts, I think you are right, I have changed it to
> > may_be_unqualified.
>
> That's wrong too. You need to use the same value that was passed
> when the predicate was originally added to the predicate table.
>
How about this?
predicate_table_restrict(OrigPredicateTable, PredIds, PredicateTable) :-
OrigPredicateTable = predicate_table(Preds, NextPredId, _,
PredNameIndex, _, _, FuncNameIndex, _, _),
PredicateTable0 = predicate_table(map__init, NextPredId, [], map__init,
map__init, map__init, map__init, map__init, map__init),
PredicateTable = list__foldl(
(func(PredId, Table0) = Table :-
PredInfo = map__lookup(Preds, PredId),
pred_info_get_is_pred_or_func(PredInfo,
IsPredOrFunc),
( IsPredOrFunc = predicate,
NameIndex = PredNameIndex
; IsPredOrFunc = function,
NameIndex = FuncNameIndex
),
pred_info_name(PredInfo, Name),
(
multi_map__nondet_search(NameIndex,
Name, PredId)
->
NeedQual = may_be_unqualified
;
NeedQual = must_be_qualified
),
predicate_table_insert_2(Table0,
yes(PredId), PredInfo,
NeedQual, no, _, Table)
), PredIds, PredicateTable0).
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list