[LLVMdev] Extracting loop body

Redmond, Paul paul.redmond at intel.com
Tue Apr 3 09:13:25 PDT 2012


Hi,

I've seen this question asked before but I haven't seen an answer..

I would like to extract the body of a (for) loop into a new function so I can do some transformations. The function ExtractCodeRegion seemed like a good candidate and I've got it to sort of work.

My problem is that ExtractCodeRegion creates a function that still contains a loop. I was able to eliminate the loop by manually splitting the blocks of the original loop body after and before induction variable uses (hard code the instructions to split on)

My question is, how can I reliably/more generally split the blocks of the loop body to avoid a loop in the extracted code region? Also, I should mention that in the presence of nested loops I would like to leave the inner loops intact.

Has anyone done anything similar or perhaps there is something obvious I am missing?

Thanks,
paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120403/42508f7d/attachment.html>


More information about the llvm-dev mailing list