Re: Path optimizations
- From: "Alex Fraser" <me@xxxxxxxxxxx>
- Date: Mon, 19 Nov 2007 17:44:38 -0000
"Tim Frink" <plfriko@xxxxxxxx> wrote in message
news:5q8er4Fum3bhU1@xxxxxxxxxxxxxxxxxxxxx
[snip]
some compilers perform profile-driven optimizations, i.e.[snip]
they first profile the program by running it and collect
information about the frequency of taken branches and
how often basic blocks have been executed. Based on that,
they get one path through the program that is executed
most frequently.
I'm now wondering what sort of optimizations can be
performed to that path. The only optimization I know
is block re-ordering by moving blocks such that unconditional
branches are eliminated on the typical path leading to
e.g. an improved pipeline behavior due to missing conditional
hazards.
As well as (and along similar lines to) reorganising the code, branch hints
can be added, if applicable to the target. Beyond that, I think the only
advantages relate to the optimiser's choices:
A better overall size/speed trade-off can be achieved by only applying
optimisations with a poor size/speed trade-off to the frequently executed
code, and/or optimising infrequently executed code for size.
Optimisations such as register allocation may improve the speed of one path
at the expense of another; profile information can be used to ensure the
common path is the one that is improved.
Alex
.
- References:
- Path optimizations
- From: Tim Frink
- Path optimizations
- Prev by Date: Re: Rant on character sets
- Next by Date: Re: Wanted some practical problems to solve in data structures
- Previous by thread: Re: Path optimizations
- Next by thread: Can Binary Search Be Improved with Threading
- Index(es):