This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Loop invariant motion from cold block


On 11/06/2014 01:00 PM, Richard Biener wrote:
Shouldn't we never hoist anything from a bb with lower execution frequency
to a bb with higher one?  It seems LIM simply assumes that inside a loop
is always higher frequency than outside of it.

So - why artificially have that factor of 0.1 instead of simply checking for
less than?
Yes, that would seem to be the best general approach. My initial hack was done wrt to example given and apparently I just kept my tunnel vision goggles on.
Btw, we also hoist through multiple loop nests so even an unlikely
branch in the innermost loop may execute more times than the outermost
loop entry.   So I believe the change has to be made somewhere else,
like in invariantness_dom_walker::before_dom_children.

Btw, for your example with calling a noreturn function in the loop exit
destination the block containing the k/5 shouldn't be in the loop at all.

I wonder why they are not using __attribute__((noreturn)) in which case
they'd even get better profiles can can get rid of the __builtin_expect?
Good point, and probably the approach that should really be taken in that code.

Thanks,
Pat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]