summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/for_codegen.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-08-14 12:25:37 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-08-14 12:25:37 +0000
commitb08f89ffc17c21ec495ad075cc79bf6624f97fa8 (patch)
treef5a14e31c9af609cd909be08619ac1f76df7a247 /clang/test/OpenMP/for_codegen.cpp
parent5d093286f0f489e79c3849cb4c76564de3ed45be (diff)
downloadbcm5719-llvm-b08f89ffc17c21ec495ad075cc79bf6624f97fa8.tar.gz
bcm5719-llvm-b08f89ffc17c21ec495ad075cc79bf6624f97fa8.zip
[OPENMP] Fix for http://llvm.org/PR24371: Assert failure compiling blender 2.75.
blender uses statements expression in condition of the loop under control of the '#pragma omp parallel for'. This condition is used several times in different expressions required for codegen of the loop directive. If there are some variables defined in statement expression, it fires an assert during codegen because of redefinition of the same variables. We have to rebuild several expression to be sure that all variables are unique. llvm-svn: 245041
Diffstat (limited to 'clang/test/OpenMP/for_codegen.cpp')
-rw-r--r--clang/test/OpenMP/for_codegen.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/clang/test/OpenMP/for_codegen.cpp b/clang/test/OpenMP/for_codegen.cpp
index c56fcbce14b..fc35a98c9ed 100644
--- a/clang/test/OpenMP/for_codegen.cpp
+++ b/clang/test/OpenMP/for_codegen.cpp
@@ -329,14 +329,9 @@ void test_precond() {
// CHECK: [[A_ADDR:%.+]] = alloca i8,
// CHECK: [[I_ADDR:%.+]] = alloca i8,
char a = 0;
- // CHECK: store i32 0, i32* [[IV_ADDR:%.+]],
- // CHECK: [[A:%.+]] = load i8, i8* [[A_ADDR]],
- // CHECK: [[CONV:%.+]] = sext i8 [[A]] to i32
- // CHECK: [[IV:%.+]] = load i32, i32* [[IV_ADDR]],
- // CHECK: [[MUL:%.+]] = mul nsw i32 [[IV]], 1
- // CHECK: [[ADD:%.+]] = add nsw i32 [[CONV]], [[MUL]]
- // CHECK: [[CONV:%.+]] = trunc i32 [[ADD]] to i8
- // CHECK: store i8 [[CONV]], i8* [[I_ADDR]],
+ // CHECK: store i8 0,
+ // CHECK: store i32
+ // CHECK: store i8
// CHECK: [[A:%.+]] = load i8, i8* [[A_ADDR]],
// CHECK: [[CONV:%.+]] = sext i8 [[A]] to i32
// CHECK: [[CMP:%.+]] = icmp slt i32 [[CONV]], 10
@@ -482,4 +477,14 @@ void loop_with_It(It<char> begin, It<char> end) {
// CHECK: call void @__kmpc_for_static_init_8(
// CHECK: call void @__kmpc_for_static_fini(
+void loop_with_stmt_expr() {
+#pragma omp for
+ for (int i = __extension__({float b = 0;b; }); i < __extension__({double c = 1;c; }); i += __extension__({char d = 1; d; }))
+ ;
+}
+// CHECK-LABEL: loop_with_stmt_expr
+// CHECK: call i32 @__kmpc_global_thread_num(
+// CHECK: call void @__kmpc_for_static_init_4(
+// CHECK: call void @__kmpc_for_static_fini(
+
#endif // HEADER
OpenPOWER on IntegriCloud