[PATCH] D158612: [flang][driver] Ensure negative flags have the same visibility as positive

2023-08-29 Thread Tom Eccles via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG125abbdc9767: [flang][driver] Ensure negative flags have the 
same visibility as positive (authored by tblah).

Changed prior to commit:
  https://reviews.llvm.org/D158612?vs=552723&id=554232#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158612/new/

https://reviews.llvm.org/D158612

Files:
  clang/include/clang/Driver/Options.td
  flang/test/Driver/driver-help-hidden.f90
  flang/test/Driver/driver-help.f90
  flang/test/Driver/fintegrated-as.f90
  flang/test/Driver/fno-integrated-as.f90

Index: flang/test/Driver/fintegrated-as.f90
===
--- flang/test/Driver/fintegrated-as.f90
+++ 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"
Index: flang/test/Driver/driver-help.f90
===
--- flang/test/Driver/driver-help.f90
+++ flang/test/Driver/driver-help.f90
@@ -39,6 +39,7 @@
 ! HELP-NEXT: -fhonor-nansSpecify 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= Specify the default character set for source files
+! HELP-NEXT: -fintegrated-as Enable the integrated assembler
 ! HELP-NEXT: -fintrinsic-modules-path 
 ! 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
Index: flang/test/Driver/driver-help-hidden.f90
===
--- flang/test/Driver/driver-help-hidden.f90
+++ flang/test/Driver/driver-help-hidden.f90
@@ -43,6 +43,7 @@
 ! CHECK-NEXT: -fhonor-nansSpecify 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= Specify the default character set for source files
+! CHECK-NEXT: -fintegrated-as Enable the integrated assembler
 ! CHECK-NEXT: -fintrinsic-modules-path 
 ! CHECK-NEXT: Specify where to find the compiled intrinsic modules
 ! CHECK-NEXT: -flang-experimental-hlfir
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2368,13 +2368,13 @@
   PosFlag,
-  NegFlag>;
+  NegFlag>;
 defm approx_func : BoolFOption<"approx-func", LangOpts<"ApproxFunc">, DefaultFalse,
PosFlag,
-   NegFlag>;
+   NegFlag>;
 defm finite_math_only : BoolFOption<"finite-math-only",
   LangOpts<"FiniteMathOnly">, DefaultFalse,
   PosFlag,
-  PosFlag>;
+  PosFlag>;
 def fhonor_nans : Flag<["-"], "fhonor-nans">, Group,
   Visibility<[ClangOption, FlangOption]>,
   HelpText<"Specify that floating-point optimizations are not allowed that "
@@ -3385,12 +3385,12 @@
   LangOpts<"ROPI">, DefaultFalse,
   PosFlag,
-  NegFlag>;
+  NegFlag>;
 defm rwpi : BoolFOption<"rwpi",
   LangOpts<"RWPI">, DefaultFalse,
   PosFlag,
-  NegFlag>;
+  NegFlag>;
 def fplugin_EQ : Joined<["-"], "fplugin=">, Group,
   Flags<[NoXarchOption]>, MetaVarName<"">,
   HelpText<"Load the named plugin (dynamic shared object)">;
@@ -5313,7 +5313,7 @@
 defm integrated_as : BoolFOption<"integrated-as",
   CodeGenOpts<"DisableIntegratedAS">, DefaultFalse,
   NegFlag,
-  PosFlag,
+  PosFlag,
   BothFlags<[], [ClangOption], " the integrated assembler">>;
 
 def fintegrated_cc1 : Flag<["-"], "fintegrated-cc1">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D158612: [flang][driver] Ensure negative flags have the same visibility as positive

2023-08-23 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added inline comments.



Comment at: flang/test/Driver/fintegrated-as.f90:15
+!
+! Without `-fno-integrated-as` (default) / With `-fintegrated-as`
+!

The default is `-fintegrated-as`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158612/new/

https://reviews.llvm.org/D158612

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D158612: [flang][driver] Ensure negative flags have the same visibility as positive

2023-08-23 Thread Tom Eccles via Phabricator via cfe-commits
tblah updated this revision to Diff 552723.
tblah added a comment.

Thanks for taking a look.

Changes: add test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158612/new/

https://reviews.llvm.org/D158612

Files:
  clang/include/clang/Driver/Options.td
  flang/test/Driver/driver-help-hidden.f90
  flang/test/Driver/driver-help.f90
  flang/test/Driver/fintegrated-as.f90
  flang/test/Driver/fno-integrated-as.f90

Index: flang/test/Driver/fintegrated-as.f90
===
--- flang/test/Driver/fintegrated-as.f90
+++ 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` (default) / With `-fintegrated-as`
+!
 ! 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"
Index: flang/test/Driver/driver-help.f90
===
--- flang/test/Driver/driver-help.f90
+++ flang/test/Driver/driver-help.f90
@@ -39,6 +39,7 @@
 ! HELP-NEXT: -fhonor-nansSpecify 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= Specify the default character set for source files
+! HELP-NEXT: -fintegrated-as Enable the integrated assembler
 ! HELP-NEXT: -fintrinsic-modules-path 
 ! 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
Index: flang/test/Driver/driver-help-hidden.f90
===
--- flang/test/Driver/driver-help-hidden.f90
+++ flang/test/Driver/driver-help-hidden.f90
@@ -43,6 +43,7 @@
 ! CHECK-NEXT: -fhonor-nansSpecify 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= Specify the default character set for source files
+! CHECK-NEXT: -fintegrated-as Enable the integrated assembler
 ! CHECK-NEXT: -fintrinsic-modules-path 
 ! CHECK-NEXT: Specify where to find the compiled intrinsic modules
 ! CHECK-NEXT: -flang-experimental-hlfir
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2366,13 +2366,13 @@
   PosFlag,
-  NegFlag>;
+  NegFlag>;
 defm approx_func : BoolFOption<"approx-func", LangOpts<"ApproxFunc">, DefaultFalse,
PosFlag,
-   NegFlag>;
+   NegFlag>;
 defm finite_math_only : BoolFOption<"finite-math-only",
   LangOpts<"FiniteMathOnly">, DefaultFalse,
   PosFlag,
-  PosFlag>;
+  PosFlag>;
 def fhonor_nans : Flag<["-"], "fhonor-nans">, Group,
   Visibility<[ClangOption, FlangOption]>,
   HelpText<"Specify that floating-point optimizations are not allowed that "
@@ -3383,12 +3383,12 @@
   LangOpts<"ROPI">, DefaultFalse,
   PosFlag,
-  NegFlag>;
+  NegFlag>;
 defm rwpi : BoolFOption<"rwpi",
   LangOpts<"RWPI">, DefaultFalse,
   PosFlag,
-  NegFlag>;
+  NegFlag>;
 def fplugin_EQ : Joined<["-"], "fplugin=">, Group,
   Flags<[NoXarchOption]>, MetaVarName<"">,
   HelpText<"Load the named plugin (dynamic shared object)">;
@@ -5311,7 +5311,7 @@
 defm integrated_as : BoolFOption<"integrated-as",
   CodeGenOpts<"DisableIntegratedAS">, DefaultFalse,
   NegFlag,
-  PosFlag,
+  PosFlag,
   BothFlags<[], [ClangOption], " the integrated assembler">>;
 
 def fintegrated_cc1 : Flag<["-"], "fintegrated-cc1">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D158612: [flang][driver] Ensure negative flags have the same visibility as positive

2023-08-23 Thread Andrzej Warzynski via Phabricator via cfe-commits
awarzynski accepted this revision.
awarzynski added a comment.
This revision is now accepted and ready to land.

LGTM, ta!




Comment at: clang/include/clang/Driver/Options.td:5314
   NegFlag,
-  PosFlag,
+  PosFlag,
   BothFlags<[], [ClangOption], " the integrated assembler">>;

Could you add a test? 
https://github.com/llvm/llvm-project/blob/main/flang/test/Driver/fno-integrated-as.f90

I would probably rename that file as `integrated-as.f90` and test 3 variants:
```
! RUN: 
! RUN: -fintegrated-as
! RUN: -fno-integrated-as
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158612/new/

https://reviews.llvm.org/D158612

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D158612: [flang][driver] Ensure negative flags have the same visibility as positive

2023-08-23 Thread Tom Eccles via Phabricator via cfe-commits
tblah created this revision.
tblah added reviewers: awarzynski, bogner, MaskRay.
Herald added a reviewer: sscalpone.
Herald added projects: Flang, All.
tblah requested review of this revision.
Herald added subscribers: cfe-commits, jdoerfert.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158612

Files:
  clang/include/clang/Driver/Options.td
  flang/test/Driver/driver-help-hidden.f90
  flang/test/Driver/driver-help.f90


Index: flang/test/Driver/driver-help.f90
===
--- flang/test/Driver/driver-help.f90
+++ flang/test/Driver/driver-help.f90
@@ -39,6 +39,7 @@
 ! HELP-NEXT: -fhonor-nansSpecify 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= Specify the default character set for 
source files
+! HELP-NEXT: -fintegrated-as Enable the integrated assembler
 ! HELP-NEXT: -fintrinsic-modules-path 
 ! 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
Index: flang/test/Driver/driver-help-hidden.f90
===
--- flang/test/Driver/driver-help-hidden.f90
+++ flang/test/Driver/driver-help-hidden.f90
@@ -43,6 +43,7 @@
 ! CHECK-NEXT: -fhonor-nansSpecify 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= Specify the default character set for 
source files
+! CHECK-NEXT: -fintegrated-as Enable the integrated assembler
 ! CHECK-NEXT: -fintrinsic-modules-path 
 ! CHECK-NEXT: Specify where to find the compiled 
intrinsic modules
 ! CHECK-NEXT: -flang-experimental-hlfir
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2366,13 +2366,13 @@
   PosFlag,
-  NegFlag>;
+  NegFlag>;
 defm approx_func : BoolFOption<"approx-func", LangOpts<"ApproxFunc">, 
DefaultFalse,
PosFlag,
-   NegFlag>;
+   NegFlag>;
 defm finite_math_only : BoolFOption<"finite-math-only",
   LangOpts<"FiniteMathOnly">, DefaultFalse,
   PosFlag,
-  PosFlag>;
+  PosFlag>;
 def fhonor_nans : Flag<["-"], "fhonor-nans">, Group,
   Visibility<[ClangOption, FlangOption]>,
   HelpText<"Specify that floating-point optimizations are not allowed that "
@@ -3383,12 +3383,12 @@
   LangOpts<"ROPI">, DefaultFalse,
   PosFlag,
-  NegFlag>;
+  NegFlag>;
 defm rwpi : BoolFOption<"rwpi",
   LangOpts<"RWPI">, DefaultFalse,
   PosFlag,
-  NegFlag>;
+  NegFlag>;
 def fplugin_EQ : Joined<["-"], "fplugin=">, Group,
   Flags<[NoXarchOption]>, MetaVarName<"">,
   HelpText<"Load the named plugin (dynamic shared object)">;
@@ -5311,7 +5311,7 @@
 defm integrated_as : BoolFOption<"integrated-as",
   CodeGenOpts<"DisableIntegratedAS">, DefaultFalse,
   NegFlag,
-  PosFlag,
+  PosFlag,
   BothFlags<[], [ClangOption], " the integrated assembler">>;
 
 def fintegrated_cc1 : Flag<["-"], "fintegrated-cc1">,


Index: flang/test/Driver/driver-help.f90
===
--- flang/test/Driver/driver-help.f90
+++ flang/test/Driver/driver-help.f90
@@ -39,6 +39,7 @@
 ! HELP-NEXT: -fhonor-nansSpecify 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= Specify the default character set for source files
+! HELP-NEXT: -fintegrated-as Enable the integrated assembler
 ! HELP-NEXT: -fintrinsic-modules-path 
 ! 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
Index: flang/test/Driver/driver-help-hidden.f90
===
--- flang/test/Driver/driver-help-hidden.f90
+++ fl