[flang-commits] [flang] 125abbd - [flang][driver] Ensure negative flags have the same visibility as positive
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Tue Aug 29 02:53:59 PDT 2023
Author: Tom Eccles
Date: 2023-08-29T09:48:28Z
New Revision: 125abbdc97671d8300cfc1ebcc010d8d4248974b
URL: https://github.com/llvm/llvm-project/commit/125abbdc97671d8300cfc1ebcc010d8d4248974b
DIFF: https://github.com/llvm/llvm-project/commit/125abbdc97671d8300cfc1ebcc010d8d4248974b.diff
LOG: [flang][driver] Ensure negative flags have the same visibility as positive
https://reviews.llvm.org/D157151 and https://reviews.llvm.org/D157837
added visibility flags to flang options, hiding options which are
supported only in Clang and not in Flang.
After this change, some negative flags e.g. `-fno-reciprocal-math` no
longer work with flang. These flags are supported in flang (as can be
seen from the support for the positive flags).
I also opted to make sure the clang visibility is the same on these
flags, although I did not look at changing the visibility of non-flang
flags.
Differential Revision: https://reviews.llvm.org/D158612
Added:
flang/test/Driver/fintegrated-as.f90
Modified:
clang/include/clang/Driver/Options.td
flang/test/Driver/driver-help-hidden.f90
flang/test/Driver/driver-help.f90
Removed:
flang/test/Driver/fno-integrated-as.f90
################################################################################
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 72e24656eca217..072030a44f01de 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2368,13 +2368,13 @@ defm reciprocal_math : BoolFOption<"reciprocal-math",
PosFlag<SetTrue, [], [ClangOption, CC1Option, FC1Option, FlangOption],
"Allow division operations to be reassociated",
[funsafe_math_optimizations.KeyPath]>,
- NegFlag<SetFalse>>;
+ NegFlag<SetFalse, [], [ClangOption, CC1Option, FC1Option, FlangOption]>>;
defm approx_func : BoolFOption<"approx-func", LangOpts<"ApproxFunc">, DefaultFalse,
PosFlag<SetTrue, [], [ClangOption, CC1Option, FC1Option, FlangOption],
"Allow certain math function calls to be replaced "
"with an approximately equivalent calculation",
[funsafe_math_optimizations.KeyPath]>,
- NegFlag<SetFalse>>;
+ NegFlag<SetFalse, [], [ClangOption, CC1Option, FC1Option, FlangOption]>>;
defm finite_math_only : BoolFOption<"finite-math-only",
LangOpts<"FiniteMathOnly">, DefaultFalse,
PosFlag<SetTrue, [], [ClangOption, CC1Option],
@@ -2388,7 +2388,7 @@ defm signed_zeros : BoolFOption<"signed-zeros",
NegFlag<SetTrue, [], [ClangOption, CC1Option, FC1Option, FlangOption],
"Allow optimizations that ignore the sign of floating point zeros",
[cl_no_signed_zeros.KeyPath, funsafe_math_optimizations.KeyPath]>,
- PosFlag<SetFalse>>;
+ PosFlag<SetFalse, [], [ClangOption, CC1Option, FC1Option, FlangOption]>>;
def fhonor_nans : Flag<["-"], "fhonor-nans">, Group<f_Group>,
Visibility<[ClangOption, FlangOption]>,
HelpText<"Specify that floating-point optimizations are not allowed that "
@@ -3385,12 +3385,12 @@ defm ropi : BoolFOption<"ropi",
LangOpts<"ROPI">, DefaultFalse,
PosFlag<SetTrue, [], [ClangOption, FlangOption, CC1Option],
"Generate read-only position independent code (ARM only)">,
- NegFlag<SetFalse>>;
+ NegFlag<SetFalse, [], [ClangOption, FlangOption, CC1Option]>>;
defm rwpi : BoolFOption<"rwpi",
LangOpts<"RWPI">, DefaultFalse,
PosFlag<SetTrue, [], [ClangOption, FlangOption, CC1Option],
"Generate read-write position independent code (ARM only)">,
- NegFlag<SetFalse>>;
+ NegFlag<SetFalse, [], [ClangOption, FlangOption, CC1Option]>>;
def fplugin_EQ : Joined<["-"], "fplugin=">, Group<f_Group>,
Flags<[NoXarchOption]>, MetaVarName<"<dsopath>">,
HelpText<"Load the named plugin (dynamic shared object)">;
@@ -5313,7 +5313,7 @@ def y : Joined<["-"], "y">;
defm integrated_as : BoolFOption<"integrated-as",
CodeGenOpts<"DisableIntegratedAS">, DefaultFalse,
NegFlag<SetTrue, [], [ClangOption, CC1Option, FlangOption], "Disable">,
- PosFlag<SetFalse, [], [ClangOption], "Enable">,
+ PosFlag<SetFalse, [], [ClangOption, CC1Option, FlangOption], "Enable">,
BothFlags<[], [ClangOption], " the integrated assembler">>;
def fintegrated_cc1 : Flag<["-"], "fintegrated-cc1">,
diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90
index 888e580d4e845e..7aae2b195815e2 100644
--- a/flang/test/Driver/driver-help-hidden.f90
+++ b/flang/test/Driver/driver-help-hidden.f90
@@ -43,6 +43,7 @@
! CHECK-NEXT: -fhonor-nans Specify that floating-point optimizations are not allowed that assume arguments and results are not NANs.
! CHECK-NEXT: -fimplicit-none No implicit typing allowed unless overridden by IMPLICIT statements
! CHECK-NEXT: -finput-charset=<value> Specify the default character set for source files
+! CHECK-NEXT: -fintegrated-as Enable the integrated assembler
! CHECK-NEXT: -fintrinsic-modules-path <dir>
! CHECK-NEXT: Specify where to find the compiled intrinsic modules
! CHECK-NEXT: -flang-experimental-hlfir
diff --git a/flang/test/Driver/driver-help.f90 b/flang/test/Driver/driver-help.f90
index c82f72dff164d7..549bec6aca58c1 100644
--- a/flang/test/Driver/driver-help.f90
+++ b/flang/test/Driver/driver-help.f90
@@ -39,6 +39,7 @@
! HELP-NEXT: -fhonor-nans Specify that floating-point optimizations are not allowed that assume arguments and results are not NANs.
! HELP-NEXT: -fimplicit-none No implicit typing allowed unless overridden by IMPLICIT statements
! HELP-NEXT: -finput-charset=<value> Specify the default character set for source files
+! HELP-NEXT: -fintegrated-as Enable the integrated assembler
! HELP-NEXT: -fintrinsic-modules-path <dir>
! HELP-NEXT: Specify where to find the compiled intrinsic modules
! HELP-NEXT: -flarge-sizes Use INTEGER(KIND=8) for the result type in size-related intrinsics
diff --git a/flang/test/Driver/fno-integrated-as.f90 b/flang/test/Driver/fintegrated-as.f90
similarity index 58%
rename from flang/test/Driver/fno-integrated-as.f90
rename to flang/test/Driver/fintegrated-as.f90
index d0f917d57ad830..516d3501dc8d16 100644
--- a/flang/test/Driver/fno-integrated-as.f90
+++ b/flang/test/Driver/fintegrated-as.f90
@@ -1,4 +1,4 @@
-! Tests for the `-fno-integrated-as` flag.
+! Tests for the `-f(no-)integrated-as` flag.
! UNSUPPORTED: system-windows
@@ -11,10 +11,11 @@
! CHECK-SAME: "-o" "[[assembly_file:.*]].s"
! CHECK-NEXT: "-o" "{{.*}}.o" "[[assembly_file:.*]].s"
-!-----------------------------
-! Without `-fno-integrated-as`
-!-----------------------------
+!----------------------------------------------------------------
+! Without `-fno-integrated-as` / With `-fintegrated-as` (default)
+!----------------------------------------------------------------
! Verify that there _is no_ separate line with an assembler invocation
+! RUN: %flang -c -fintegrated-as %s -### 2>&1 | FileCheck %s -check-prefix=DEFAULT
! RUN: %flang -c %s -### 2>&1 | FileCheck %s -check-prefix=DEFAULT
! DEFAULT-LABEL: "-fc1"
-! DEFAULT-SAME: "-o" "{{.*}}.o" "{{.*}}fno-integrated-as.f90"
+! DEFAULT-SAME: "-o" "{{.*}}.o" "{{.*}}fintegrated-as.f90"
More information about the flang-commits
mailing list