> > whole-program optimisation and SMP machines have been around for a
> > fair while now, so I'm guessing not.
>
> I don't know of anything that is particularly hard about it, but, if
> you know of bits that are hard, or have pointer to such, I'd be
> interested in it.
You imply you're considering backporting this to 4.2. I'd be amazed if that
was worthwhile. I'd expect changes to be required in pretty much the whole
compiler.
Your strategy is built around the assumption that the majority of the work can
be split into multiple independent chunks of work. There are several fairly
obvious places where that is hard. eg. the frontend probably needs to process
the whole file in series because previous declarations effect later code. And
inter-procedural optimisations (eg. inlining) don't lend themselves to
splitting on function boundaries.
Actually, most IPA optimizations parallelize very well.
Pointer analysis, inlining, can all be partitioned in ways that work
can be split into threads.
Mike is actually not saying anything that most people around here
truly disagree with. We all want to eventually parallelize and
distribute GCC optimizations. I just don't think we are at the point
where it makes sense to start doing that yet. Personally, I believe
the time to start thinking about parallelizing about this stuff is
when the problems that make LTO hard (getting rid of all the little
niggles like front ends generating RTL, and doing the hard stuff like
a middle end type system) are solved. Why?. Without solving the
problems that make LTO hard, you are going to hit them in trying to
make the IPA optimizations (or anything else) parallel, because they
are exactly the shared state between functions and global state
problems that GCC has.
In fact, various people (including me) have been been discussing how
to parallelize and distribute our optimizations for a few months now.
So if you really want to help parallelizing along, the thing to do is
help LTO right now.
I'm happy to commit to parallelizing IPA pointer analysis (which is a
ridiculously parallel problem) once the hard LTO problems are solved.
Before then, I just think we are going to end up with a bunch of hacks
to try to work around our shared state.
--Dan