Skip to content

Commit 745f3fd

Browse files
committed
[Fortran/gfortran] add mechanism to track support for alternate flags
The idea is to add feature gated denylist files to be appended to the base denylists. The additional features are specified with cmake -DTEST_SUITE_FORTRAN_FEATURES="FEATURE1 FEATURE2". The must be DisabledFilesFEATURE.cmake files present. One alternative would be to make including the DisabledFilesFEATURE.cmake files optional. I decided not to do this because on my system cmake takes a few seconds longer to configure when the files to be included are optionally absent. Furthermore, it is good to get some kind of error if the feature name is misspelt. As an example, this patch includes denylists for HLFIR. I run with -fstack-arrays -O3 -mcpu-native -flto -flang-experimental-hlfir, but so far as I know the additional failures are all due to HLFIR. I would expect the same denylists to work for just -flang-experimental-hlfir. I expect there are many tests which are disabled by default which will now work with HLFIR, but I haven't yet had chance to determine which these are. Differential Revision: https://reviews.llvm.org/D156130
1 parent 867cb3e commit 745f3fd

36 files changed

+424
-0
lines changed

Fortran/gfortran/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,30 @@ macro(gfortran_populate_tests TESTS)
260260
list(APPEND SKIPPED ${SKIPPED_FILES})
261261
list(APPEND FAILING ${FAILING_FILES})
262262

263+
# do the same for any requested feature extentions
264+
foreach(feature ${TEST_SUITE_FORTRAN_FEATURES})
265+
set(UNSUPPORTED_FILES "")
266+
set(UNIMPLEMENTED_FILES "")
267+
set(SKIPPED_FILES "")
268+
set(FAILING_FILES "")
269+
include(${CMAKE_CURRENT_SOURCE_DIR}/DisabledFiles${feature}.cmake)
270+
list(APPEND UNSUPPORTED ${UNSUPPORTED_FILES})
271+
list(APPEND UNIMPLEMENTED ${UNIMPLEMENTED_FILES})
272+
list(APPEND SKIPPED ${SKIPPED_FILES})
273+
list(APPEND FAILING ${FAILING_FILES})
274+
275+
# enable any tests that now pass for this feature
276+
set(SUPPORTED_FILES "")
277+
set(IMPLEMENTED_FILES "")
278+
set(UNSKIPPED_FILES "")
279+
set(PASSING_FILES "")
280+
include(${CMAKE_CURRENT_SOURCE_DIR}/EnabledFiles${feature}.cmake)
281+
list(REMOVE_ITEM UNSUPPORTED ${SUPPORTED_FILES})
282+
list(REMOVE_ITEM UNIMPLEMENTED ${IMPLEMENTED_FILES})
283+
list(REMOVE_ITEM SKIPPED ${UNSKIPPED_FILES})
284+
list(REMOVE_ITEM FAILING ${PASSING_FILES})
285+
endforeach()
286+
263287
# The TESTS variable is expected to be set before the macro is called.
264288
gfortran_find_test_files(
265289
"${UNSUPPORTED}" "${UNIMPLEMENTED}" "${SKIPPED}" "${FAILING}" "${TESTS}")

Fortran/gfortran/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ be passed to `cmake`:
7676
- `TEST_SUITE_FORTRAN_FORCE_UNIMPLEMENTED_TESTS`: Enable only the *unimplemented* tests.
7777
- `TEST_SUITE_FORTRAN_FORCE_SKIPPED_TESTS`: Enable only the *skipped* tests.
7878
- `TEST_SUITE_FORTRAN_FORCE_FAILING_TESTS`: Enable only the *failing* tests.
79+
- `TEST_SUITE_FORTRAN_FEATURES`: see the features section below
7980

8081
Some of the tests require the `ISO_Fortran_binding.h` header file. `cmake` will
8182
look for this file in the `include` directory of the `flang` installation
@@ -109,6 +110,18 @@ avoid tests failures in `llvm-test-suite/Fortran/UnitTests/fcvs21_f95`. These
109110
are unrelated to the gfortran tests here.
110111

111112

113+
### Testing non-standard features/flags
114+
115+
Additional denylists for a particular feature can be included by creating
116+
DisabledFilesFEATURE.cmake files (in the same format as those for the default
117+
denylists), and adding FEATURE to `TEST_SUITE_FORTRAN_FEATURES`. Additional
118+
compiler flags can be added using `CMAKE_Fortran_FLAGS`.
119+
120+
For example, to test HLFIR one could use
121+
`CMAKE_Fortran_Flags=-flang-experimental-hlfir` and
122+
`TEST_SUITE_FORTRAN_FEATURES=HLFIR`.
123+
124+
112125
### Notes for developers/maintainers ###
113126

114127
Since `flang` is under active development, it is expected that features will be
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#===------------------------------------------------------------------------===#
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
#===------------------------------------------------------------------------===#
8+
9+
# These tests are skipped because they hit a 'not yet implemented' assertion
10+
# in flang and thus fail to compile. They should be removed from here when the
11+
# corresponding feature is implemented. Eventually, this variable should be
12+
# removed altogether once all the missing features are implemented.
13+
file(GLOB UNIMPLEMENTED_FILES CONFIGURE_DEPENDS
14+
# unimplemented: lower descriptor designator to HLFIR value
15+
allocatable_scalar_1.f90
16+
deferred_type_param_8.f90
17+
pointer_function_actual_1.f90
18+
19+
# unimplemented: compute elemental function result length parameters in HLFIR
20+
array_temporaries_3.f90
21+
pure_byref_1.f90
22+
23+
# unimplemented: BIND(C) INTENT(OUT) allocatable deallocation in HLFIR
24+
bind_c_procs_3.f90
25+
26+
# unimplemented: character conversion in HLFIR
27+
widechar_2.f90
28+
widechar_7.f90
29+
widechar_intrinsics_10.f90
30+
31+
# unimplemented: pointer assignment inside FORALL
32+
dependency_19.f90
33+
forall_3.f90
34+
pr49698.f90
35+
)
36+
37+
# These tests are disabled because they fail when they are expected to pass.
38+
file(GLOB FAILING_FILES CONFIGURE_DEPENDS
39+
# ---------------------------------------------------------------------------
40+
#
41+
# These tests fail at runtime when they should pass. are likely a result of
42+
# unimplemented features in the runtime, but they could also be bugs. If any
43+
# will never pass with flang (if they use unsupported extensions for instance),
44+
# they should be added to the Unsupported list.
45+
46+
all_bounds_1.f90
47+
array_constructor_11.f90
48+
array_constructor_45.f90
49+
bounds_check_array_ctor_4.f90
50+
bounds_check_fail_3.f90
51+
bounds_check_12.f90
52+
function_optimize_11.f90
53+
maxloc_bounds_1.f90
54+
maxloc_bounds_2.f90
55+
maxloc_bounds_4.f90
56+
maxloc_bounds_5.f90
57+
maxloc_bounds_7.f90
58+
maxloc_bounds_8.f90
59+
pack_bounds_1.f90
60+
pr67524.f90
61+
spread_bounds_1.f90
62+
transfer_array_intrinsic_4.f90
63+
maxlocval_1.f90
64+
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#===------------------------------------------------------------------------===#
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
#===------------------------------------------------------------------------===#
8+
9+
# These are files which are skipped by default (see DisabledFiles.cmake) but
10+
# are fixed by this feature
11+
file(GLOB UNSKIPPED_FILES CONFIGURE_DEPENDS
12+
achar_4.f90
13+
char_cast_2.f90
14+
deferred_character_8.f90
15+
dependency_23.f90
16+
interface_assignment_1.f90
17+
typebound_assignment_6.f90
18+
volatile10.f90
19+
)
20+
21+
# These are files which fail by default (see DisabledFiles.cmake) but are fixed
22+
# by this feature
23+
file(GLOB PASSING_FILES CONFIGURE_DEPENDS
24+
advance_5.f90
25+
aliasing_dummy_5.f90
26+
dependency_45.f90
27+
elemental_dependency_1.f90
28+
elemental_dependency_5.f90
29+
elemental_dependency_6.f90
30+
forall_12.f90
31+
forall_17.f90
32+
internal_pack_3.f90
33+
missing_optional_dummy_6.f90
34+
mvbits_4.f90
35+
pr50069_1.f90
36+
pr68227.f90
37+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#===------------------------------------------------------------------------===#
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
#===------------------------------------------------------------------------===#
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#===------------------------------------------------------------------------===#
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
#===------------------------------------------------------------------------===#
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#===------------------------------------------------------------------------===#
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
#===------------------------------------------------------------------------===#
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#===------------------------------------------------------------------------===#
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
#===------------------------------------------------------------------------===#
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#===------------------------------------------------------------------------===#
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
#===------------------------------------------------------------------------===#
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#===------------------------------------------------------------------------===#
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
#===------------------------------------------------------------------------===#

0 commit comments

Comments
 (0)