[LLVMdev] loop pragmas

Krzysztof Parzyszek kparzysz at codeaurora.org
Tue Nov 27 08:58:05 PST 2012


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.

I'd love to see something like that in LLVM, help make it happen, etc, 
etc.  Of course, other ideas are welcome as well.  :)

-Krzysztof


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list