[OpenMP] Should we move `loop bind` mapping back to codegen?

Last year review D144634 introduced mapping of loop construct with a bind clause to for/distribute/simd, depending on specifics. I can only see the last diff, but judging from the comments this was first implemented in codegen.

The only comment about doing it in sema seemed to refer to creating temporary AST nodes in codegen (to use with Emit... functions).

The consequence of doing it in sema is that we need to keep around the original directive, plus the one after mapping, and doing different things depending on whether for directive came from the source or was the result of the mapping. All of that seems like an unnecessary complexity.

I think that moving it back to codegen, and keeping the loop directive in the AST would be much cleaner.

Are there any reasons for doing it in sema that I missed?

If you can make it without creating new AST nodes in codegen, this is fine. Otherwise it should be in Sema

At the end of the day, what we should do is emit “loop runtime calls” and let the optimizer and runtime do the binding + scheduling. Binding it in Sema or Codegen is equivalent in terms of our inability to do something smart and really use the loop restrictions in the middle end optimization pipeline.