[LLVMdev] loop pragmas

Krzysztof Parzyszek kparzysz at codeaurora.org
Tue Nov 20 12:01:36 PST 2012


On 11/20/2012 1:56 PM, Bjorn De Sutter wrote:
> Hi,
>
> I've been looking at several loop pragma discussion threads, and every now and then, people note that it is difficult to ensure that metadata (that would represent the information from the pragma) is not destroyed during optimizations. I understand that in theory CFG transformations might destroy loops, but in practice, I notice that even after heavy optimization with opt and after transformations such as if-conversion in llc, the IR seems to remember where there were loops in the code. At least that is what I make of information such as
>
> BB#28: derived from LLVM BB %for.body47.i
>    ...
> BB#43: derived from LLVM BB %while.body.i.preheader.i
>    ...
> BB#44: derived from LLVM BB %while.body.i.i
>    ...
>
> that gets printed when I run llc with -print-after-all.  So apparently, at least some loop information is passed to the compiler backend successfully. As are line numbers, by the way, and pragmas also have line numbers.
>
> So I wonder, what is the practical problem with passing information about loop pragmas as metadata on basic blocks?

The problem is that the "BB derived from %for.loop.preheader" doesn't 
really mean that the BB is still a preheader.

-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