Determine which loops are parallel in Loop pass


I have a couple of C/C++ programs I want to analyze/modify with a Loop pass, and I want to find the loops free of loop-carried dependences.
The parallel loops are annotated with the OpenMP #pragma omp parallel for directive, but OpenMP will not be used, just single-threaded execution. I can also manually annotate/tag the source code if that would help, the important part is that the pass automatically can determine whether the loop is annotated parallel or not.

I’ve seen a few interesting options that might (or might not) solve my problem.

  • llvm.mem.parallel metadata ?
  • annotate intrinsics/attributes ?

What would the simplest way to do this?

Thank you!


Hi Alex,

Did you checked “Loop::isAnnotatedParallel” ?

Probably it will help you.