[clang] [Clang] Enable -fextend-lifetimes at -Og (PR #118026)

Stephen Tozer via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 06:22:05 PST 2024


================
@@ -1834,6 +1834,14 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
     Opts.setInlining(CodeGenOptions::NormalInlining);
   }
 
+  // If we have specified -Og and have not explicitly set -fno-extend-lifetimes,
+  // then default to -fextend-lifetimes.
+  if (Arg *A = Args.getLastArg(options::OPT_O_Group);
+      A && A->containsValue("g")) {
----------------
SLTozer wrote:

Is there an advantage to having it passed through the driver? I ask mainly because I see `-fextend-lifetimes` as being a feature of `-Og` optimization, and if you invoke `clang -cc1 -Og` directly then you'd expect/hope that the optimization behaviour would be the same as `clang -Og` - I'm not too familiar with expected Clang behaviour though, so if this is quite normal for driver/frontend behaviour then I'm fine to switch it.

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


More information about the cfe-commits mailing list