[llvm-branch-commits] [clang] 6507646 - [Driver] Fix test failures when in classic Flang mode

Bryan Chan via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 24 08:41:07 PDT 2020


Author: Bryan Chan
Date: 2020-06-24T11:39:03-04:00
New Revision: 650764672b2560728067af20c3af31a1849af786

URL: https://github.com/llvm/llvm-project/commit/650764672b2560728067af20c3af31a1849af786
DIFF: https://github.com/llvm/llvm-project/commit/650764672b2560728067af20c3af31a1849af786.diff

LOG: [Driver] Fix test failures when in classic Flang mode

Add a new lit feature tag "classic_flang" to select which tests can or cannot
be run when the driver is built for classic Flang.

Added: 
    clang/test/Driver/flang/classic_flang.f95

Modified: 
    clang/CMakeLists.txt
    clang/test/Driver/autocomplete.c
    clang/test/Driver/flang/flang.f90
    clang/test/Driver/flang/flang_ucase.F90
    clang/test/Driver/flang/multiple-inputs-mixed.f90
    clang/test/Driver/flang/multiple-inputs.f90
    clang/test/Driver/fortran.f95
    clang/test/Driver/gfortran.f90
    clang/test/lit.cfg.py
    clang/test/lit.site.cfg.py.in

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index d7ebdb48f5b5..e56aba484244 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -460,7 +460,10 @@ add_definitions( -D_GNU_SOURCE )
 
 option(LLVM_ENABLE_CLASSIC_FLANG "Build support for classic Flang instead of the new built-in Flang" OFF)
 if(LLVM_ENABLE_CLASSIC_FLANG)
+  set(LLVM_ENABLE_CLASSIC_FLANG 1)
   add_definitions( -DUSE_CLASSIC_FLANG )
+else()
+  set(LLVM_ENABLE_CLASSIC_FLANG 0)
 endif()
 
 option(FLANG_LLVM_EXTENSIONS "enable the Flang LLVM extensions" OFF)

diff  --git a/clang/test/Driver/autocomplete.c b/clang/test/Driver/autocomplete.c
index 5c0bfb69f9a3..48557bf4e413 100644
--- a/clang/test/Driver/autocomplete.c
+++ b/clang/test/Driver/autocomplete.c
@@ -72,6 +72,7 @@
 // FVECLIBALL: Accelerate
 // FVECLIBALL-NEXT: MASSV
 // FVECLIBALL-NEXT: none
+// FVECLIBALL-NEXT: PGMATH
 // FVECLIBALL-NEXT: SVML
 // RUN: %clang --autocomplete=-fshow-overloads= | FileCheck %s -check-prefix=FSOVERALL
 // FSOVERALL: all

diff  --git a/clang/test/Driver/flang/classic_flang.f95 b/clang/test/Driver/flang/classic_flang.f95
new file mode 100644
index 000000000000..5156028dcd19
--- /dev/null
+++ b/clang/test/Driver/flang/classic_flang.f95
@@ -0,0 +1,28 @@
+! Check that the driver can invoke flang1 and flang2 to compile Fortran with
+! --driver-mode=flang (default when the file extension is .f95).
+
+! REQUIRES: classic_flang
+
+! RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -c %s -### 2>&1 \
+! RUN:   | FileCheck --check-prefix=CHECK-OBJECT %s
+! CHECK-OBJECT: flang1
+! CHECK-OBJECT: flang2
+! CHECK-OBJECT-SAME: "-asm" [[LLFILE:.*.ll]]
+! CHECK-OBJECT-NOT: cc1as
+! CHECK-OBJECT: clang
+! CHECK-OBJECT-SAME: -cc1
+! CHECK-OBJECT-SAME: "-o" "fortran.o"
+! CHECK-OBJECT-SAME: "-x" "ir"
+! CHECK-OBJECT-SAME: [[LLFILE]]
+
+! RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -S %s -### 2>&1 \
+! RUN:   | FileCheck --check-prefix=CHECK-ASM %s
+! CHECK-ASM: flang1
+! CHECK-ASM: flang2
+! CHECK-ASM-SAME: "-asm" [[LLFILE:.*.ll]]
+! CHECK-ASM-NOT: cc1as
+! CHECK-ASM: clang
+! CHECK-ASM-SAME: -cc1
+! CHECK-ASM-SAME: "-o" "fortran.s"
+! CHECK-ASM-SAME: "-x" "ir"
+! CHECK-ASM-SAME: [[LLFILE]]

diff  --git a/clang/test/Driver/flang/flang.f90 b/clang/test/Driver/flang/flang.f90
index 9d47c7c90225..f8d175900a7a 100644
--- a/clang/test/Driver/flang/flang.f90
+++ b/clang/test/Driver/flang/flang.f90
@@ -1,5 +1,7 @@
 ! Check that flang -fc1 is invoked when in --driver-mode=flang.
 
+! UNSUPPORTED: classic_flang
+
 ! This is a copy of flang_ucase.F90 because the driver has logic in it which
 ! 
diff erentiates between F90 and f90 files. Flang will not treat these files
 ! 
diff erently.

diff  --git a/clang/test/Driver/flang/flang_ucase.F90 b/clang/test/Driver/flang/flang_ucase.F90
index 323afb21dccf..e2215a41881a 100644
--- a/clang/test/Driver/flang/flang_ucase.F90
+++ b/clang/test/Driver/flang/flang_ucase.F90
@@ -1,5 +1,7 @@
 ! Check that flang -fc1 is invoked when in --driver-mode=flang.
 
+! UNSUPPORTED: classic_flang
+
 ! This is a copy of flang.f90 because the driver has logic in it which
 ! 
diff erentiates between F90 and f90 files. Flang will not treat these files
 ! 
diff erently.

diff  --git a/clang/test/Driver/flang/multiple-inputs-mixed.f90 b/clang/test/Driver/flang/multiple-inputs-mixed.f90
index 98d8cab00bdf..50e92aa96c85 100644
--- a/clang/test/Driver/flang/multiple-inputs-mixed.f90
+++ b/clang/test/Driver/flang/multiple-inputs-mixed.f90
@@ -1,5 +1,7 @@
 ! Check that flang can handle mixed C and fortran inputs.
 
+! UNSUPPORTED: classic_flang
+
 ! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/other.c 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s
 ! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang{{[^"/]*}}" "-fc1"
 ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90"

diff  --git a/clang/test/Driver/flang/multiple-inputs.f90 b/clang/test/Driver/flang/multiple-inputs.f90
index 34592a3dc3a3..8a48a5e664d7 100644
--- a/clang/test/Driver/flang/multiple-inputs.f90
+++ b/clang/test/Driver/flang/multiple-inputs.f90
@@ -1,5 +1,7 @@
 ! Check that flang driver can handle multiple inputs at once.
 
+! UNSUPPORTED: classic_flang
+
 ! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/two.f90 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s
 ! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1"
 ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90"

diff  --git a/clang/test/Driver/fortran.f95 b/clang/test/Driver/fortran.f95
index 03ff99f9fbfb..bdf7ad7e0216 100644
--- a/clang/test/Driver/fortran.f95
+++ b/clang/test/Driver/fortran.f95
@@ -1,6 +1,8 @@
 ! Check that the clang driver can invoke gcc to compile Fortran when in
 ! --driver-mode=clang. This is legacy behaviour - see also --driver-mode=flang.
 
+! UNSUPPORTED: classic_flang
+
 ! RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -c %s -### 2>&1 \
 ! RUN:   | FileCheck --check-prefix=CHECK-OBJECT %s
 ! CHECK-OBJECT: gcc

diff  --git a/clang/test/Driver/gfortran.f90 b/clang/test/Driver/gfortran.f90
index d2f90b47a390..0a15d2de2dfa 100644
--- a/clang/test/Driver/gfortran.f90
+++ b/clang/test/Driver/gfortran.f90
@@ -1,7 +1,9 @@
 ! Test that Clang can forward all of the flags which are documented as
 ! being supported by gfortran to GCC when falling back to GCC for
 ! a fortran input file.
-!
+
+! UNSUPPORTED: classic_flang
+
 ! RUN: %clang -no-canonical-prefixes -target i386-linux -### %s -o %t 2>&1 \
 ! RUN:     -Aquestion=answer \
 ! RUN:     -A-question=answer \

diff  --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 1ffb6d094d72..cd423a104e6a 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -193,3 +193,6 @@ def calculate_arch_features(arch_string):
 
 if config.enable_shared:
     config.available_features.add("enable_shared")
+
+if config.use_classic_flang:
+    config.available_features.add("classic_flang")

diff  --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index 520afab6af82..7fae101a26be 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -30,6 +30,7 @@ config.host_arch = "@HOST_ARCH@"
 config.python_executable = "@PYTHON_EXECUTABLE@"
 config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@")
 config.has_plugins = @LLVM_ENABLE_PLUGINS@
+config.use_classic_flang = @LLVM_ENABLE_CLASSIC_FLANG@
 
 # Support substitution of the tools and libs dirs with user parameters. This is
 # used when we can't determine the tool dir at configuration time.


        


More information about the llvm-branch-commits mailing list