Re: [PATCH] newlib: libc: Improved the readability of strcspn with minor optimization
Brian Inglis <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Organization | Systematic Software |
| Message-ID | <[email protected]> |
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!]