[LLVMdev] Where do I put the propeller?

Dan Gohman dan433584 at gmail.com
Tue Nov 27 10:50:49 PST 2012

On Tue, Nov 27, 2012 at 8:58 AM, Krzysztof Parzyszek <
kparzysz at codeaurora.org> wrote:

> On 11/27/2012 8:03 AM, Hal Finkel wrote:
>> This still leaves the question of exactly how to attach metadata to
>> loops, etc.
> In one implementation, the loops had a fixed structure: guard branch,
> preheader, header and loop body, optional epilog.  The structure was
> clearly identified by various means (flags, bits, etc.).  No optimization
> in the optimizer (roughly a counterpart of the LLVM's bitcode optimizer)
> was allowed to alter it.  For example, CFG simplification could change
> branches all it wanted, *except* the branches that were a part of the loop
> structure.  A "continue" inside of a loop would not create a nested loop,
> etc.  This worked like a dream (hence my limited appreciation for
> SimplifyCFG...).
> In that implementation, the metadata was placed in the loop header, or the
> loop preheader, depending on what information it was.  Since any code that
> would try to move things around in a loop would have to know what it's
> doing (i.e. would have to be aware of the loop structure and what the rules
> were), there was no risk that the metadata would become accidentally
> separated from the loop.

Here is an analogy for your consideration. "Where do I put the propeller?"

LLVM (the optimizer/codegen) is like a car design. It's got a good engine,
frame, and other parts. It's got an active community of people around
refining the design and using it for many purposes. It's a good car for
these people.

OpenMP and similar pragmas are like a helicopter design. A few people have
decided that they wish to design helicopters. It's a lot of work to design
a complete helicopter, and a helicopter needs some of the same things a car
needs, so their plan is to take this popular car design and attach
a propeller and other things that they'll need. They're really excited
about this because it will free them from worrying about the boring parts
so that they can focus on the cool parts like propeller blades and flight
control surfaces. However, there are a few minor issues. We just need
somewhere to attach a propeller. And we'll need to make the transmission
design modular so that we can do some custom things there. And possibly a
few other minor tweaks that will come up as we go forward. It shouldn't be

Then they encounter some friction. Most of the people around primarily care
about cars. Some of them think that helicopters sound cool, and are eager
to help figure out how to attach a propeller mount to the car roof, however
they find that the frame of the car isn't prepared to handle that kind of
load. A redesign of the frame, or somehow making the frame modular, is not
something that can be trivially dropped in. The car people find themselves
pushing back. Then the helicopter people point out that in other helicopter
designs, most of the important parts were designed specifically for a
helicopter's needs, and that that is widely considered the best design
methodology for helicopters, and so why can't we do that here?

You want a no-compromise helicopter, and you are talking about starting
from a car conversion kit helicopter. Quite possibly you can meet your
goals with this approach, and you may save a fair amount of work, however
you'll also end up making compromises and doing extra work that you
wouldn't have otherwise needed. Which approach is best depends on many

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121127/6546a86e/attachment.html>

More information about the llvm-dev mailing list