Add changes adapted from clang-omp/llvm
e45b045553e027cbe400cbb8ac8c264abbbfaf83.