summaryrefslogtreecommitdiffstats
path: root/test/OpenMP/for_codegen.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-08-06 12:30:57 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-08-06 12:30:57 +0000
commitaca4fe314a55cacae29e1548cb7bfd2119c6df4c (patch)
tree9816e93d7c0011fddb5d09d0ce48f0332476eb96 /test/OpenMP/for_codegen.cpp
parentaf8d90c61e6406161b9e095bdc96e50e27867751 (diff)
[OPENMP 4.1] Allow references in init expression for loop-based constructs.
OpenMP 4.1 allows to use variables with reference types in private clauses and, therefore, in init expressions of the cannonical loop forms. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244209 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/OpenMP/for_codegen.cpp')
-rw-r--r--test/OpenMP/for_codegen.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/OpenMP/for_codegen.cpp b/test/OpenMP/for_codegen.cpp
index 7f7e9ba9d2..c56fcbce14 100644
--- a/test/OpenMP/for_codegen.cpp
+++ b/test/OpenMP/for_codegen.cpp
@@ -411,6 +411,21 @@ void for_with_global_lcv() {
}
}
+// CHECK-LABEL: for_with_references
+void for_with_references() {
+// CHECK: [[I:%.+]] = alloca i8,
+// CHECK: [[CNT:%.+]] = alloca i8*,
+// CHECK: [[CNT_PRIV:%.+]] = alloca i8,
+// CHECK: call void @__kmpc_for_static_init_4(
+// CHECK-NOT: load i8, i8* [[CNT]],
+// CHECK: call void @__kmpc_for_static_fini(
+ char i = 0;
+ char &cnt = i;
+#pragma omp for
+ for (cnt = 0; cnt < 2; ++cnt)
+ k = cnt;
+}
+
struct Bool {
Bool(bool b) : b(b) {}
operator bool() const { return b; }