[m-rev.] for review: Simplify away self-comparisons of variables of int types.

Peter Wang novalazy at gmail.com
Tue Oct 23 19:01:16 AEDT 2018


On Tue, 23 Oct 2018 18:27:37 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> 
> 
> On Tue, 23 Oct 2018 16:43:29 +1100, Peter Wang <novalazy at gmail.com> wrote:
> > compiler/simplify_goal_call.m:
> >     Replace calls to comparison predicates < > =< >= of int types in
> >     which both arguments are the same variable with 'true' or 'false'
> >     goals.
> > 
> >     Replace calls to builtin.compare/3 where the compared arguments are
> >     the same variable with a goal that assigns (=) as the comparison
> >     result.
> > 
> >     Factor out common simplifications to all int types.
> 
> I  see how this diff factors them out for all *sized* int/uint types;
> I don't see how it factors them out for int and uint.
> Then again, that may be because the diff is hard to read,
> because the diff algorithm got confused and accidentally
> resynchronized on matched lines that happen to be irrelevant.

simplify_improve_int_call and simplify_improve_uint_call
call the new predicate simplify_improve_int_type_call.

> 
> In any case, since I assume this diff passes bootcheck,
> I think you should commit it, and I will have a proper look
> this evening.

Done.

Peter


More information about the reviews mailing list