Re: [llvm-dev] [cfe-dev] How Pragma Unroll works in clang and llvm

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Re: [llvm-dev] [cfe-dev] How Pragma Unroll works in clang and llvm

George Karpenkov via llvm-dev
On 8/10/2017 10:48 AM, Nisal Menuka via cfe-dev wrote:

> Hi,
> I am trying to understand how Pragma Unroll is implemented in clang and llvm.
> According to my understanding, this pragma is processed and new token
> is generated in clang/lib/Parse/ParsePragma.cpp
> PragmaUnrollHintHandler::HandlePragma function.
> Then the token is processed in *handleLoopHintAttr in
> clang/lib/Sema/SemaStmtAttr.cpp file.
> But its not clear to me how this information is parsed to LLVM and processed.

clang annotates the IR for the loop with metadata, then the loop unroll
pass uses that metadata to unroll the loop as requested.  See for a description of
the metadata.  If you want to read the related code, grep for


Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

LLVM Developers mailing list
[hidden email]