[OPENMP]Fix PR49115: Incorrect results for scan directive.

For combined worksharing directives need to emit the temp arrays outside
of the parallel region and update them in the master thread only.

Differential Revision: https://reviews.llvm.org/D100187

GitOrigin-RevId: 10c7b9f64fa6c0257fe8a7f89123afb5e463ebda
4 files changed