Doacross loops should not be collapsed

Hi all,

a while ago I created a bug report on this issue (

The following directive should not result in collapsing the for loops:
#pragma omp parallel for ordered(2)

Since we now ran into the same issue while implementing the OMPT events for doacross loops, I tried to understand what is the issue in the compiler. I think, that both SemaOpenMP.cpp and CGOpenMPRuntime.cpp make wrong assumptions on the behavior of doacross loops.

One of the assumptions is, that the vec argument should always have length 1. The vector length should probably be
ordered-num - collapsed-num + 1

Any suggestions, how this should be fixed in a clean way?