Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flang] Update -falias-analysis help text #73548

Closed
wants to merge 1 commit into from

Conversation

tblah
Copy link
Contributor

@tblah tblah commented Nov 27, 2023

As requested by @branach-space on #73111. This makes it clearer that -f[no-]alias-analysis will always override -O flags, no matter their ordering.

As requested by @branach-space on llvm#73111. This makes it clearer that
-f[no-]alias-analysis will always override -O flags, no matter their
ordering.
@llvmbot llvmbot added clang Clang issues not falling into any other category flang:driver flang Flang issues not falling into any other category labels Nov 27, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 27, 2023

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-flang-driver

Author: Tom Eccles (tblah)

Changes

As requested by @branach-space on #73111. This makes it clearer that -f[no-]alias-analysis will always override -O flags, no matter their ordering.


Full diff: https://github.com/llvm/llvm-project/pull/73548.diff

3 Files Affected:

  • (modified) clang/include/clang/Driver/Options.td (+2-2)
  • (modified) flang/test/Driver/driver-help-hidden.f90 (+2-2)
  • (modified) flang/test/Driver/driver-help.f90 (+4-4)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 9689f12fd01417b..3a6df56496ed0f3 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6334,8 +6334,8 @@ defm loop_versioning : BoolOptionWithoutMarshalling<"f", "version-loops-for-stri
   PosFlag<SetTrue, [], [ClangOption], "Create unit-strided versions of loops">,
    NegFlag<SetFalse, [], [ClangOption], "Do not create unit-strided loops (default)">>;
 defm alias_analysis : BoolOptionWithoutMarshalling<"f", "alias-analysis",
-  PosFlag<SetTrue, [], [], "Pass alias information on to LLVM (default when optimizing for speed)">,
-  NegFlag<SetFalse, [], [], "Do not pass alias information on to LLVM (default for unoptimized builds)">>;
+  PosFlag<SetTrue, [], [], "Pass alias information on to LLVM (default when optimizing for speed). Overrides -O0.">,
+  NegFlag<SetFalse, [], [], "Do not pass alias information on to LLVM (default for unoptimized builds). Overrides -O flags.">>;
 } // let Visibility = [FC1Option, FlangOption]
 
 def J : JoinedOrSeparate<["-"], "J">,
diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90
index b276f1906e1a457..f005c43b1d990c4 100644
--- a/flang/test/Driver/driver-help-hidden.f90
+++ b/flang/test/Driver/driver-help-hidden.f90
@@ -26,7 +26,7 @@
 ! CHECK-NEXT: -D <macro>=<value>      Define <macro> to <value> (or 1 if <value> omitted)
 ! CHECK-NEXT: -emit-llvm              Use the LLVM representation for assembler and object files
 ! CHECK-NEXT: -E                      Only run the preprocessor
-! CHECK-NEXT: -falias-analysis        Pass alias information on to LLVM (default when optimizing for speed)
+! CHECK-NEXT: -falias-analysis        Pass alias information on to LLVM (default when optimizing for speed). Overrides -O0.
 ! CHECK-NEXT: -falternative-parameter-statement
 ! CHECK-NEXT:                         Enable the old style PARAMETER statement
 ! CHECK-NEXT: -fapprox-func           Allow certain math function calls to be replaced with an approximately equivalent calculation
@@ -63,7 +63,7 @@
 ! CHECK-NEXT: -flto                   Enable LTO in 'full' mode
 ! CHECK-NEXT: -fms-runtime-lib=<value>
 ! CHECK-NEXT:                         Select Windows run-time library
-! CHECK-NEXT: -fno-alias-analysis     Do not pass alias information on to LLVM (default for unoptimized builds)
+! CHECK-NEXT: -fno-alias-analysis     Do not pass alias information on to LLVM (default for unoptimized builds). Overrides -O flags.
 ! CHECK-NEXT: -fno-automatic          Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE
 ! CHECK-NEXT: -fno-color-diagnostics  Disable colors in diagnostics
 ! CHECK-NEXT: -fno-integrated-as      Disable the integrated assembler
diff --git a/flang/test/Driver/driver-help.f90 b/flang/test/Driver/driver-help.f90
index 452c62541e72e61..0cd05c0a64ac062 100644
--- a/flang/test/Driver/driver-help.f90
+++ b/flang/test/Driver/driver-help.f90
@@ -22,7 +22,7 @@
 ! HELP-NEXT: -D <macro>=<value>      Define <macro> to <value> (or 1 if <value> omitted)
 ! HELP-NEXT: -emit-llvm              Use the LLVM representation for assembler and object files
 ! HELP-NEXT: -E                      Only run the preprocessor
-! HELP-NEXT: -falias-analysis        Pass alias information on to LLVM (default when optimizing for speed)
+! HELP-NEXT: -falias-analysis        Pass alias information on to LLVM (default when optimizing for speed). Overrides -O0.
 ! HELP-NEXT: -falternative-parameter-statement
 ! HELP-NEXT:                         Enable the old style PARAMETER statement
 ! HELP-NEXT: -fapprox-func           Allow certain math function calls to be replaced with an approximately equivalent calculation
@@ -53,7 +53,7 @@
 ! HELP-NEXT: -flto                   Enable LTO in 'full' mode
 ! HELP-NEXT: -fms-runtime-lib=<value>
 ! HELP-NEXT:                         Select Windows run-time library
-! HELP-NEXT: -fno-alias-analysis     Do not pass alias information on to LLVM (default for unoptimized builds)
+! HELP-NEXT: -fno-alias-analysis     Do not pass alias information on to LLVM (default for unoptimized builds). Overrides -O flags.
 ! HELP-NEXT: -fno-automatic          Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE
 ! HELP-NEXT: -fno-color-diagnostics  Disable colors in diagnostics
 ! HELP-NEXT: -fno-integrated-as      Disable the integrated assembler
@@ -149,7 +149,7 @@
 ! HELP-FC1-NEXT: -emit-llvm              Use the LLVM representation for assembler and object files
 ! HELP-FC1-NEXT: -emit-obj               Emit native object files
 ! HELP-FC1-NEXT: -E                      Only run the preprocessor
-! HELP-FC1-NEXT: -falias-analysis        Pass alias information on to LLVM (default when optimizing for speed)
+! HELP-FC1-NEXT: -falias-analysis        Pass alias information on to LLVM (default when optimizing for speed). Overrides -O0.
 ! HELP-FC1-NEXT: -falternative-parameter-statement
 ! HELP-FC1-NEXT:                         Enable the old style PARAMETER statement
 ! HELP-FC1-NEXT: -fapprox-func           Allow certain math function calls to be replaced with an approximately equivalent calculation
@@ -196,7 +196,7 @@
 ! HELP-FC1-NEXT: -flogical-abbreviations Enable logical abbreviations
 ! HELP-FC1-NEXT: -flto=<value>           Set LTO mode
 ! HELP-FC1-NEXT: -flto                   Enable LTO in 'full' mode
-! HELP-FC1-NEXT: -fno-alias-analysis     Do not pass alias information on to LLVM (default for unoptimized builds)
+! HELP-FC1-NEXT: -fno-alias-analysis     Do not pass alias information on to LLVM (default for unoptimized builds). Overrides -O flags.
 ! HELP-FC1-NEXT: -fno-analyzed-objects-for-unparse
 ! HELP-FC1-NEXT:                         Do not use the analyzed objects when unparsing
 ! HELP-FC1-NEXT: -fno-automatic          Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE

@tblah
Copy link
Contributor Author

tblah commented Nov 27, 2023

@banach-space I'm happy to change the behavior too if you'd prefer that

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

@banach-space I'm happy to change the behavior too if you'd prefer that

That would be great, but could be done independently. Up to you!

In general, I feel that -f{no-}alias-analysis interacts with -O{#N} in a way that should be avoided. But I'd need to look more into how -O{#N} are defined to have a more informed opinion. So just restricting this option for now (provided it still work for you in the intended way) should be fine.

clang/include/clang/Driver/Options.td Show resolved Hide resolved
@tblah
Copy link
Contributor Author

tblah commented Dec 5, 2023

Closing this because I decided to just remove the -f[no-]alias-analysis flags instead. #74343

@tblah tblah closed this Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category flang:driver flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants