Specifics of barriers

The standard states that

“If barrier is inside a conditional statement, then all
work-items must enter the conditional if any work-item
enters the conditional statement and executes the
barrier.”

Does “balanced” barrier usage have defined behavior or all the work-items must enter the same branch? In the other words, do the following examples conform to the standard?


if (cond) {
   barrier(...);
}
else {
   barrier(...);
}


if (cond) {
    barrier(...);
    return;
}

barrier(...);

Thanks for your time.

Neither of those examples are valid according to the standard. All work items in a work-group must hit the exact same barrier.