summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-05-23 22:30:43 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2019-05-23 22:30:43 +0000
commite0ef04f8cb295a95c49e8436f59d5a4b58e92d15 (patch)
tree0291689cf3c4d973b70ce7ff9f48c95845fb79d1 /clang/test
parent5554a5fcbdd7a889e133a80c064e4e553fa4fae4 (diff)
downloadbcm5719-llvm-e0ef04f8cb295a95c49e8436f59d5a4b58e92d15.tar.gz
bcm5719-llvm-e0ef04f8cb295a95c49e8436f59d5a4b58e92d15.zip
[OPENMP]Do not crash for const firstprivates.
If the variable is a firstprivate variable and it was not emitted beause this a constant variable with the constant initializer, we can use the initial value instead of the variable itself. It also fixes the problem with the compiler crash in this case. llvm-svn: 361564
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/OpenMP/parallel_firstprivate_codegen.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/test/OpenMP/parallel_firstprivate_codegen.cpp b/clang/test/OpenMP/parallel_firstprivate_codegen.cpp
index 8aa64668f05..2a306d1272f 100644
--- a/clang/test/OpenMP/parallel_firstprivate_codegen.cpp
+++ b/clang/test/OpenMP/parallel_firstprivate_codegen.cpp
@@ -335,8 +335,9 @@ int main() {
s_arr[0] = var;
sivar = 2;
}
-#pragma omp parallel allocate(omp_default_mem_alloc: t_var) firstprivate(t_var)
- {}
+ const int a = 0;
+#pragma omp parallel allocate(omp_default_mem_alloc: t_var) firstprivate(t_var, a)
+ { t_var = a; }
return tmain<int>();
#endif
}
@@ -346,6 +347,7 @@ int main() {
// CHECK: [[T_VAR:%.+]] = alloca i32,
// CHECK: [[T_VARCAST:%.+]] = alloca [[iz:i64|i32]],
// CHECK: [[SIVARCAST:%.+]] = alloca [[iz]],
+// CHECK: [[A:%.+]] = alloca i32,
// CHECK: [[T_VARCAST1:%.+]] = alloca [[iz:i64|i32]],
// CHECK: call {{.*}} [[S_FLOAT_TY_DEF_CONSTR:@.+]]([[S_FLOAT_TY]]* [[TEST]])
// CHECK: [[T_VARVAL:%.+]] = load i32, i32* [[T_VAR]],
@@ -420,6 +422,7 @@ int main() {
// CHECK-32: [[T_VAR_VAL:%.+]] = load i32, i32* [[T_VAR_ADDR]],
// CHECK-64: [[T_VAR_VAL:%.+]] = load i32, i32* [[BC]],
// CHECK: store i32 [[T_VAR_VAL]], i32* [[T_VAR_PRIV]],
+// CHECK: store i32 0, i32* [[T_VAR_PRIV]],
// CHECK: call void @__kmpc_free(i32 [[GTID]], i8* [[T_VAR_VOID_PTR]], i8* inttoptr ([[iz]] 1 to i8*))
// CHECK: ret void
OpenPOWER on IntegriCloud