public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
To: newlib@sourceware.org
Subject: Re: [PATCH] newlib: libc: Improved the readability of strcspn with minor optimization
Date: Thu, 21 Dec 2023 10:47:26 -0700	[thread overview]
Message-ID: <624e89ca-5499-425c-86b1-3b5d5eab2f43@SystematicSW.ab.ca> (raw)
In-Reply-To: <1MHoN2-1rTvdF0opK-00ExJb@mail.gmx.net>

On 2023-12-21 01:00, Stefan Tauner wrote:
> On Wed, 20 Dec 2023 15:24:10 -0700 Brian Inglis wrote:
>> Using gotos throw away potential optimizations in modern compilers
> {{citation needed}}

Please note that is a simplification to make the point.
No gotos means reducible flow graphs which allow easier analysis and optimization.
The main problem is the creation of irreducible flow graphs using gotos.
Compilers may be able to convert irreducible flow graphs to reducible flow 
graphs, eliminating the gotos by restructuring.
This may then allow the code to meet preconditions allowing further loop or 
block optimizations designed for structured reducible flow graphs.

See:
https://groups.seas.harvard.edu/courses/cs153/2019fa/lectures/Lec23-Loop-optimization.pdf

	https://escholarship.mcgill.ca/concern/theses/x633f2516

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

[I was stunned into more structured approaches early on by having to work on a 
large monolithic uncommented Fortran program that used *only* assigned gotos 
with meaningless random numeric labels and dozens of human named label variables 
e.g.
...
813	ASSIGN 105 to FRED
	GOTO JIM
534	IF (I.GT.0) GO TO JOHN
	GOTO JACK
105	ASSIGN 534 to ANDY
	GOTO MIKE
...
interspersed with some matrix calculations. Aaaargh!]

  reply	other threads:[~2023-12-21 17:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  8:31 Xiao Zeng
2023-12-15 10:28 ` Torbjorn SVENSSON
2023-12-16  4:45   ` Xiao Zeng
2023-12-16  4:56     ` Xiao Zeng
2023-12-20 15:08     ` Torbjorn SVENSSON
2023-12-21  1:22       ` Xiao Zeng
2023-12-16  9:30   ` Xiao Zeng
2023-12-20  4:24     ` Jeff Johnston
2023-12-20  5:51       ` Xiao Zeng
2023-12-20 22:24       ` Brian Inglis
2023-12-21  8:00         ` Stefan Tauner
2023-12-21 17:47           ` Brian Inglis [this message]
2023-12-22  7:53 Xiao Zeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=624e89ca-5499-425c-86b1-3b5d5eab2f43@SystematicSW.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).