[OpenMP Dialect] Workshare loop lowering flow

Thanks, @SouraVX for the question. I believe the one operation flow is the top contender now. But I will answer since you asked.

If the conversion is not possible then that would signal an error. There is no alternative flow. It is just that that two operations might be good for,

  1. Debugging of the lowering from parse tree to MLIR. (And assuming no OpenMP specific transformations have happened and there are no calls to the runtime directly in the code).
  2. If the OpenMP IRBuilder is capable of only lowering a single loop then it provides the opportunity in MLIR to do the loop collapse operation.
  3. The directive operation provides an easy to use mechanism to use inside MLIR. Like someone might have an affine loop or scf loop and they would want to parallelize it, then putting the omp.do operation around the loop is straightforward.