Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit f3056a3

Browse files
committed
[OPENMP 4.0] Allow to use 'omp simd' directive inside other simd-regions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259465 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4bea19d commit f3056a3

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

lib/Sema/SemaOpenMP.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,7 +1925,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
19251925
// | simd | for simd | |
19261926
// | simd | master | |
19271927
// | simd | critical | |
1928-
// | simd | simd | |
1928+
// | simd | simd | * |
19291929
// | simd | sections | |
19301930
// | simd | section | |
19311931
// | simd | single | |
@@ -1959,7 +1959,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
19591959
// | for simd | for simd | |
19601960
// | for simd | master | |
19611961
// | for simd | critical | |
1962-
// | for simd | simd | |
1962+
// | for simd | simd | * |
19631963
// | for simd | sections | |
19641964
// | for simd | section | |
19651965
// | for simd | single | |
@@ -1993,7 +1993,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
19931993
// | parallel for simd| for simd | |
19941994
// | parallel for simd| master | |
19951995
// | parallel for simd| critical | |
1996-
// | parallel for simd| simd | |
1996+
// | parallel for simd| simd | * |
19971997
// | parallel for simd| sections | |
19981998
// | parallel for simd| section | |
19991999
// | parallel for simd| single | |
@@ -2434,7 +2434,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
24342434
// | taskloop simd | for simd | |
24352435
// | taskloop simd | master | |
24362436
// | taskloop simd | critical | |
2437-
// | taskloop simd | simd | |
2437+
// | taskloop simd | simd | * |
24382438
// | taskloop simd | sections | |
24392439
// | taskloop simd | section | |
24402440
// | taskloop simd | single | |
@@ -2509,7 +2509,8 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
25092509
ShouldBeInTargetRegion,
25102510
ShouldBeInTeamsRegion
25112511
} Recommend = NoRecommend;
2512-
if (isOpenMPSimdDirective(ParentRegion) && CurrentRegion != OMPD_ordered) {
2512+
if (isOpenMPSimdDirective(ParentRegion) && CurrentRegion != OMPD_ordered &&
2513+
CurrentRegion != OMPD_simd) {
25132514
// OpenMP [2.16, Nesting of Regions]
25142515
// OpenMP constructs may not be nested inside a simd region.
25152516
// OpenMP [2.8.1,simd Construct, Restrictions]

test/OpenMP/nesting_of_regions.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void foo() {
137137
}
138138
#pragma omp simd
139139
for (int i = 0; i < 10; ++i) {
140-
#pragma omp simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
140+
#pragma omp simd
141141
for (int i = 0; i < 10; ++i)
142142
;
143143
}
@@ -468,7 +468,7 @@ void foo() {
468468
}
469469
#pragma omp for simd
470470
for (int i = 0; i < 10; ++i) {
471-
#pragma omp simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
471+
#pragma omp simd
472472
for (int i = 0; i < 10; ++i)
473473
;
474474
}
@@ -1730,7 +1730,7 @@ void foo() {
17301730
}
17311731
#pragma omp parallel for simd
17321732
for (int i = 0; i < 10; ++i) {
1733-
#pragma omp simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
1733+
#pragma omp simd
17341734
for (int i = 0; i < 10; ++i)
17351735
;
17361736
}
@@ -3504,7 +3504,7 @@ void foo() {
35043504
}
35053505
#pragma omp simd
35063506
for (int i = 0; i < 10; ++i) {
3507-
#pragma omp simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3507+
#pragma omp simd
35083508
for (int i = 0; i < 10; ++i)
35093509
;
35103510
}
@@ -3818,7 +3818,7 @@ void foo() {
38183818
}
38193819
#pragma omp for simd
38203820
for (int i = 0; i < 10; ++i) {
3821-
#pragma omp simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3821+
#pragma omp simd
38223822
for (int i = 0; i < 10; ++i)
38233823
;
38243824
}
@@ -5053,7 +5053,7 @@ void foo() {
50535053
}
50545054
#pragma omp parallel for simd
50555055
for (int i = 0; i < 10; ++i) {
5056-
#pragma omp simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
5056+
#pragma omp simd
50575057
for (int i = 0; i < 10; ++i)
50585058
;
50595059
}

0 commit comments

Comments
 (0)