[LLVMdev] loop pragmas

Bjorn De Sutter bjorn.desutter at elis.ugent.be
Tue Nov 20 11:56:44 PST 2012


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?

Thanks,

Bjorn De Sutter
Computer Systems Lab
Ghent University








More information about the llvm-dev mailing list