diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-06-15 11:20:48 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-06-15 11:20:48 +0000 |
commit | b46cdeae9f5e94b12ca321e91ddef0974440222e (patch) | |
tree | 62b128b0c81b10883ad0382acaef3f687f68aff5 /clang/test | |
parent | 86e786bd17603b3839a8654ddae7710a63f8008d (diff) | |
download | bcm5719-llvm-b46cdeae9f5e94b12ca321e91ddef0974440222e.tar.gz bcm5719-llvm-b46cdeae9f5e94b12ca321e91ddef0974440222e.zip |
[OPENMP] Fix crash for 'schedule|dist_schedule' clauses during
instantiation.
Added checks for non-dependent context when trygin to capture
non-constant schedule chunk expression for proper codegen of outlined
functions.
llvm-svn: 272775
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/OpenMP/distribute_codegen.cpp | 22 | ||||
-rw-r--r-- | clang/test/OpenMP/for_codegen.cpp | 21 |
2 files changed, 43 insertions, 0 deletions
diff --git a/clang/test/OpenMP/distribute_codegen.cpp b/clang/test/OpenMP/distribute_codegen.cpp index f15a62c59bc..23a5e14b943 100644 --- a/clang/test/OpenMP/distribute_codegen.cpp +++ b/clang/test/OpenMP/distribute_codegen.cpp @@ -238,4 +238,26 @@ void test_precond() { // no templates for now, as these require special handling in target regions and/or declare target +// HCHECK-LABEL: fint +// HCHECK: call {{.*}}i32 {{.+}}ftemplate +// HCHECK: ret i32 + +// HCHECK: load i16, i16* +// HCHECK: store i16 % +// HCHECK: call i32 @__tgt_target_teams( +// HCHECK: call void @__kmpc_for_static_init_4( +template <typename T> +T ftemplate() { + short aa = 0; + +#pragma omp target +#pragma omp teams +#pragma omp distribute dist_schedule(static, aa) + for (int i = 0; i < 100; i++) { + } + return T(); +} + +int fint(void) { return ftemplate<int>(); } + #endif diff --git a/clang/test/OpenMP/for_codegen.cpp b/clang/test/OpenMP/for_codegen.cpp index 39fd63fea76..1d24403a09f 100644 --- a/clang/test/OpenMP/for_codegen.cpp +++ b/clang/test/OpenMP/for_codegen.cpp @@ -492,4 +492,25 @@ void loop_with_stmt_expr() { // CHECK: call void @__kmpc_for_static_init_4( // CHECK: call void @__kmpc_for_static_fini( + +// CHECK-LABEL: fint +// CHECK: call {{.*}}i32 {{.*}}ftemplate +// CHECK: ret i32 + +// CHECK: load i16, i16* +// CHECK: store i16 % +// CHECK: call void {{.+}}@__kmpc_fork_call( +// CHECK: call void @__kmpc_for_static_init_4( +template <typename T> +T ftemplate() { + short aa = 0; + +#pragma omp parallel for schedule(static, aa) + for (int i = 0; i < 100; i++) { + } + return T(); +} + +int fint(void) { return ftemplate<int>(); } + #endif // HEADER |