================
@@ -0,0 +1,538 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --check-globals all --include-generated-funcs 
--prefix-filecheck-ir-name _ --version 5
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -fopenmp-version=60 
-x c++ -std=c++17  -emit-llvm %s -o - | FileCheck %s
+// expected-no-diagnostics
+#define N 10
+class Sum {
+  int val;
+public:
+  Sum(int v = 0) : val(v) {}
+  Sum operator+(const Sum& rhs) const {
+    return Sum(val + rhs.val);
+  }
+  Sum& operator+=(const Sum& rhs) {
+    val += rhs.val;
+    return *this;
+  }
+};
+#pragma omp declare reduction(sum_reduction : Sum : omp_out += omp_in) 
initializer(omp_priv = Sum(0))
+
+void func_red(){
+  Sum result(0);
+  Sum array[N];
+
+  for (int i = 0; i < N; i++) {
+    array[i] = Sum(i);
+  }
+
+  #pragma omp parallel private(result)  num_threads(4)
+  {
+  #pragma omp  for reduction(sum_reduction:result)
+  for (int i = 0; i < N; i++) {
+    result = result + array[i];
+  }
+  }
+}
+
+void do_red(int n, int *v, int &sum_v)
+ {
+         sum_v = 0;
+        #pragma omp for reduction(original(private),+: sum_v)
----------------
chandraghale wrote:

Updated !!


https://github.com/llvm/llvm-project/pull/134709
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to