[LLVMdev] Loop Metadata?

Devang Patel dpatel at apple.com
Fri Feb 10 11:14:22 PST 2012


On Feb 10, 2012, at 10:19 AM, Hal Finkel <hfinkel at anl.gov> wrote:

> Is there currently a good way of attaching metadata to loops?
> 
> The use case that I have in mind is implementing a feature whereby the
> user can put
> #pragma unroll(N)
> above a loop and that serves has an instruction to the optimizer to
> unroll the loop N times.
> 
> I understand that LLVM does not have a first-class loop construct, but
> would attaching the metadata to the instructions that branch to the loop
> header be a good idea?

That's the starting point. The key is how to chose loop identifying instruction (or instructions ?) for the annotation and preserve the annotation through transformations. At some point during optimization, it may be a good idea to hand it over to LoopPassManager.

-
Devang

> I also wonder whether whatever mechanism would work for this purpose
> would also work for implementing OpenMP support.
> 
> Thanks again,
> Hal
> 
> -- 
> Hal Finkel
> Postdoctoral Appointee
> Leadership Computing Facility
> Argonne National Laboratory
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list