[flang-commits] [clang] [flang] [flang] Enable alias tags pass by default (PR #73111)

Andrzej WarzyƄski via flang-commits flang-commits at lists.llvm.org
Wed Nov 22 13:15:21 PST 2023


================
@@ -142,6 +142,26 @@ void Flang::addCodegenOptions(const ArgList &Args,
   if (shouldLoopVersion(Args))
     CmdArgs.push_back("-fversion-loops-for-stride");
 
+  Arg *aliasAnalysis = Args.getLastArg(options::OPT_falias_analysis,
+                                       options::OPT_fno_alias_analysis);
+  Arg *optLevel =
+      Args.getLastArg(options::OPT_Ofast, options::OPT_O, options::OPT_O4);
+  if (aliasAnalysis) {
+    bool falias_analysis =
+        aliasAnalysis->getOption().matches(options::OPT_falias_analysis);
+    // only pass on the argument if it does not match that implied by the
+    // optimization level
+    if (optLevel) {
+      if (!falias_analysis) {
+        CmdArgs.push_back("-fno-alias-analysis");
+      }
+    } else {
----------------
banach-space wrote:

```suggestion
    if (optLevel && !falias_analysis) {
        CmdArgs.push_back("-fno-alias-analysis");
     }
```
?

https://github.com/llvm/llvm-project/pull/73111


More information about the flang-commits mailing list