================
@@ -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);
----------------
kiranchandramohan wrote:

> That's fine, but then one has to decide whether -f{no}-alias-analysis 
> overrides -O{n} or not? I think that "explicit" request from a user should 
> always take precedence. This leads to (pseudo code):
>
> opts.AliasAnalysis = 0;
> if (opt level requiring alias analysis)
>  opts.AliasAnalysis  = 1;
> 
> / / User request takes precedence when it comes to alias analysis.
> if (-falias-analysis or -fno-alias-analysis) then
>  "do whatever the user requested"
>Separately, could you check what Clang does and make sure that that would be 
>consistent?

@banach-space This is exactly the handling in the front-end driver as given 
below (and in `lib/Frontend/CompilerInvocation`). The flang driver is only 
deciding whether to forward or not.

```
  opts.AliasAnalysis = opts.OptimizationLevel > 0;
  if (auto *arg =
          args.getLastArg(clang::driver::options::OPT_falias_analysis,
                          clang::driver::options::OPT_fno_alias_analysis))
    opts.AliasAnalysis =
        arg->getOption().matches(clang::driver::options::OPT_falias_analysis);
```

https://github.com/llvm/llvm-project/pull/73111
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to