[PATCH] D109321: [clang][OpenMP] Fix the bug in codegen for ordered directive
Peixin Qiao via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 6 06:42:45 PDT 2021
peixin added a comment.
`for (i = 0; i < N; i++)` --> `for (i = 1; i < N; i++)`
#include <iostream>
using namespace std;
int main() {
float a[10];
int i, N = 10;
for (i = 0; i < N; i++)
a[i] = 0;
#pragma omp simd
for (i = 1; i < N; i++) {
#pragma omp ordered simd
a[i] = a[i-1] + 1.0;
}
for (i = 0; i < N; i++)
cout << a[i] << " ";
cout << endl;
}
$ clang++ -fopenmp simd.cpp && ./a.out
0 1 2 3 4 5 6 7 8 9
$ clang++ -fopenmp -O1 simd.cpp && ./a.out
0 1 1 1 1 2 1 1 1 2
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109321/new/
https://reviews.llvm.org/D109321
More information about the cfe-commits
mailing list