<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div>Hi,</div><div><br></div><div><br></div><div>I want to execute the iterations of a loop in parallel, by inserting calls either to pthreads or to the gomp library at the LLVM IR level. As a first step, I inserted an omp pragma in a C file and compiled it with llvm-gcc to check the generated LLVM code. If I understand correctly, to parallelize the loop in LLVM IR, I have to separate the loop in a new function, put all required parameters in a structure, make the call to the gomp library, and restore all values from the structure in the original variables.</div><div>Also, I have to compute the number of iterations allocated to each thread and insert in the loop body a new condition, such that each thread executes only its slice.</div><div><br></div><div>Is that correct?</div><div><br></div><div>As far as I know, both llvm-gcc and Polly
 already offer support for OpenMP, by inserting calls to the gomp library. Can this code be reused? Is there a pass that I can call to do all these code transformations? <br></div><div><br></div><div>I had a look at the CodeGeneration from Polly. Is it possible to use it without creating the Scops, by transforming it into a LoopPass?</div><div>Could you indicate how is this handled in llvm-gcc?</div><div><br></div><div>Thank you for your help.</div><div><br></div><div>Alexandra.<br></div><div><br></div></div></body></html>