Re: Optimization techniques

Kaz Kylheku <847-115-0292@kylheku.com>
Fri, 26 Apr 2019 02:26:37 +0000 (UTC)

          From comp.compilers

Related articles
[14 earlier articles]
Re: Optimization techniques david.brown@hesbynett.no (David Brown) (2019-04-23)
Re: Optimization techniques rick.c.hodgin@gmail.com (Rick C. Hodgin) (2019-04-24)
Re: Optimization techniques martin@gkc.org.uk (Martin Ward) (2019-04-25)
Re: Optimization techniques david.brown@hesbynett.no (David Brown) (2019-04-25)
Re: Optimization techniques 847-115-0292@kylheku.com (Kaz Kylheku) (2019-04-25)
Re: Optimization techniques 847-115-0292@kylheku.com (Kaz Kylheku) (2019-04-26)
Re: Optimization techniques 847-115-0292@kylheku.com (Kaz Kylheku) (2019-04-26)
Re: Optimization techniques alexfrunews@gmail.com (2019-04-26)
Re: Optimization techniques derek@_NOSPAM_knosof.co.uk (Derek M. Jones) (2019-04-26)
Re: Optimization techniques martin@gkc.org.uk (Martin Ward) (2019-04-26)
Re: Optimization techniques martin@gkc.org.uk (Martin Ward) (2019-04-26)
Re: Optimization techniques 847-115-0292@kylheku.com (Kaz Kylheku) (2019-04-26)
Re: Optimization techniques 0xe2.0x9a.0x9b@gmail.com (2019-04-27)
[16 later articles]
| List of all articles for this month |

From: Kaz Kylheku <847-115-0292@kylheku.com>
Newsgroups: comp.compilers
Date: Fri, 26 Apr 2019 02:26:37 +0000 (UTC)
Organization: Aioe.org NNTP Server
References: <72d208c9-169f-155c-5e73-9ca74f78e390@gkc.org.uk> 19-04-021
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="30955"; mail-complaints-to="abuse@iecc.com"
Keywords: optimize, design, comment
Posted-Date: 25 Apr 2019 22:34:54 EDT

On 2019-04-25, David Brown <david.brown@hesbynett.no> wrote:
> It knows that "x * 2 / 2" is "x". It knows that "x + 1 > x" is true.


Also, we could have it so that multiplication wraps, and yet in the same
breath allow algebraic reductions like this anyway.


Basically it can be so that, if overflow takes place in the abstract
semantics of "x * 2 / 2", the result can be either the truncated
version, or just x, if the algebraic reduction took place.


Algebraic reductions that can change the result can be confined
to evaluation regions similar to (perhaps tied to) sequence points,
such that if we write:


    int y = x * 2;
    int z = y / 2;


then the calculations are belabored; z is not reduced to x.


Anyway, anyone who wants "x * 2 / 2" to be reduced to "x" through layers
of macrology can always use a more sophisticated macro processor. Parse
it, build a tree, and do the optimization in the preprocessor.


C should serve as a stable "higher level assembly" target for that sort
of thing.
[I take your point but there's an awful lot of macros doing data structure
stuff that frequently give you this kind of code. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.