[flang-commits] [clang] [flang] Add IR Profile-Guided Optimization (IR PGO) support to the Flang compiler (PR #136098)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Apr 22 04:00:58 PDT 2025


================
@@ -882,6 +882,14 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
   // TODO: Handle interactions between -w, -pedantic, -Wall, -WOption
   Args.AddLastArg(CmdArgs, options::OPT_w);
 
+
+  if (Args.hasArg(options::OPT_fprofile_generate)){ 
+    CmdArgs.push_back("-fprofile-generate");
+  }
+  if (const Arg *A = Args.getLastArg(options::OPT_fprofile_use_EQ)) {
+    CmdArgs.push_back(Args.MakeArgString(std::string("-fprofile-use=") + A->getValue()));
+  }
----------------
tblah wrote:

nit: I think it would be simpler to use
```suggestion
  Args.addAllArgs(CmdArgs, {OPT_fprofile_generate, OPT_fprofile_use_EQ});
```

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


More information about the flang-commits mailing list