[LLVMdev] Where do I put the propeller?

Chris Lattner clattner at apple.com
Tue Nov 27 11:24:54 PST 2012


On Nov 27, 2012, at 10:50 AM, Dan Gohman <dan433584 at gmail.com> wrote:
> 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?"

Personally, I find that to be a ridiculous and unhelpful analogy.  It is clearly possible and useful to represent loop information in LLVM IR.  OpenMP is one particular use of it, but there are plenty of others.

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


More information about the llvm-dev mailing list