Skip to content

Commit 77a3ae5

Browse files
authored
[flang][OpenMP] Remove recognition of versions 3.0 and older (#145708)
The oldest supported version is now 3.1. In terms of semantic analysis the compiler treats all versions <= 4.5 identically, and there is no plan to add version-specific checks for older versions. See discourse thread: https://discourse.llvm.org/t/rfc-remove-openmp-versions-prior-to-3-1/86901
1 parent 287b24e commit 77a3ae5

File tree

3 files changed

+3
-30
lines changed

3 files changed

+3
-30
lines changed

flang/include/flang/Support/OpenMP-features.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,8 @@ namespace Fortran::common {
1515
template <typename FortranPredefinitions>
1616
void setOpenMPMacro(int version, FortranPredefinitions &predefinitions) {
1717
switch (version) {
18-
case 20:
19-
predefinitions.emplace_back("_OPENMP", "200011");
20-
break;
21-
case 25:
22-
predefinitions.emplace_back("_OPENMP", "200505");
23-
break;
24-
case 30:
25-
predefinitions.emplace_back("_OPENMP", "200805");
26-
break;
2718
case 31:
19+
default:
2820
predefinitions.emplace_back("_OPENMP", "201107");
2921
break;
3022
case 40:
@@ -45,10 +37,6 @@ void setOpenMPMacro(int version, FortranPredefinitions &predefinitions) {
4537
case 60:
4638
predefinitions.emplace_back("_OPENMP", "202411");
4739
break;
48-
case 11:
49-
default:
50-
predefinitions.emplace_back("_OPENMP", "199911");
51-
break;
5240
}
5341
}
5442
} // namespace Fortran::common

flang/test/Driver/bbc-openmp-version-macro.f90

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
11
! Test predefined _OPENMP macro which denotes OpenMP version
22

33
! RUN: bbc -fopenmp -o - %s | FileCheck %s --check-prefix=DEFAULT-OPENMP-VERSION
4-
! RUN: bbc -fopenmp -fopenmp-version=11 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-11
5-
! RUN: bbc -fopenmp -fopenmp-version=11 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-11
6-
! RUN: bbc -fopenmp -fopenmp-version=20 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-20
7-
! RUN: bbc -fopenmp -fopenmp-version=25 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-25
8-
! RUN: bbc -fopenmp -fopenmp-version=30 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-30
94
! RUN: bbc -fopenmp -fopenmp-version=31 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-31
105
! RUN: bbc -fopenmp -fopenmp-version=40 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-40
116
! RUN: bbc -fopenmp -fopenmp-version=45 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-45
127
! RUN: bbc -fopenmp -fopenmp-version=50 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-50
138
! RUN: bbc -fopenmp -fopenmp-version=51 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-51
149
! RUN: bbc -fopenmp -fopenmp-version=52 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-52
10+
! RUN: bbc -fopenmp -fopenmp-version=60 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-60
1511

1612
! DEFAULT-OPENMP-VERSION: {{.*}} = arith.constant 201107 : i32
17-
! OPENMP-VERSION-11: {{.*}} = arith.constant 199911 : i32
18-
! OPENMP-VERSION-20: {{.*}} = arith.constant 200011 : i32
19-
! OPENMP-VERSION-25: {{.*}} = arith.constant 200505 : i32
20-
! OPENMP-VERSION-30: {{.*}} = arith.constant 200805 : i32
2113
! OPENMP-VERSION-31: {{.*}} = arith.constant 201107 : i32
2214
! OPENMP-VERSION-40: {{.*}} = arith.constant 201307 : i32
2315
! OPENMP-VERSION-45: {{.*}} = arith.constant 201511 : i32
2416
! OPENMP-VERSION-50: {{.*}} = arith.constant 201811 : i32
2517
! OPENMP-VERSION-51: {{.*}} = arith.constant 202011 : i32
2618
! OPENMP-VERSION-52: {{.*}} = arith.constant 202111 : i32
19+
! OPENMP-VERSION-60: {{.*}} = arith.constant 202411 : i32
2720

2821
#if _OPENMP
2922
integer :: var1 = _OPENMP

flang/test/Driver/flang-openmp-version-macro.f90

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
! Test predefined _OPENMP macro which denotes OpenMP version
22

33
! RUN: %flang_fc1 -fopenmp -cpp -E %s | FileCheck %s --check-prefix=DEFAULT-OPENMP-VERSION
4-
! RUN: %flang_fc1 -fopenmp -fopenmp-version=11 -cpp -E %s | FileCheck %s --check-prefix=OPENMP-VERSION-11
5-
! RUN: %flang_fc1 -fopenmp -fopenmp-version=20 -cpp -E %s | FileCheck %s --check-prefix=OPENMP-VERSION-20
6-
! RUN: %flang_fc1 -fopenmp -fopenmp-version=25 -cpp -E %s | FileCheck %s --check-prefix=OPENMP-VERSION-25
7-
! RUN: %flang_fc1 -fopenmp -fopenmp-version=30 -cpp -E %s | FileCheck %s --check-prefix=OPENMP-VERSION-30
84
! RUN: %flang_fc1 -fopenmp -fopenmp-version=31 -cpp -E %s | FileCheck %s --check-prefix=OPENMP-VERSION-31
95
! RUN: %flang_fc1 -fopenmp -fopenmp-version=40 -cpp -E %s | FileCheck %s --check-prefix=OPENMP-VERSION-40
106
! RUN: %flang_fc1 -fopenmp -fopenmp-version=45 -cpp -E %s | FileCheck %s --check-prefix=OPENMP-VERSION-45
@@ -14,10 +10,6 @@
1410
! RUN: %flang_fc1 -fopenmp -fopenmp-version=60 -cpp -E %s | FileCheck %s --check-prefix=OPENMP-VERSION-60
1511

1612
! DEFAULT-OPENMP-VERSION: integer :: var1 = 201107
17-
! OPENMP-VERSION-11: integer :: var1 = 199911
18-
! OPENMP-VERSION-20: integer :: var1 = 200011
19-
! OPENMP-VERSION-25: integer :: var1 = 200505
20-
! OPENMP-VERSION-30: integer :: var1 = 200805
2113
! OPENMP-VERSION-31: integer :: var1 = 201107
2214
! OPENMP-VERSION-40: integer :: var1 = 201307
2315
! OPENMP-VERSION-45: integer :: var1 = 201511

0 commit comments

Comments
 (0)