[clang] [flang] [mlir] [LLVM-Flang][Options] Add support for '-fprofile-sample-use' option (PR #188697)

Tarun Prabhu via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 26 06:17:31 PDT 2026


================
@@ -1099,6 +1102,26 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
   Args.addAllArgs(
       CmdArgs, {options::OPT_fprofile_generate, options::OPT_fprofile_use_EQ});
 
+  if (!(IsCudaDevice || IsHIPDevice)) {
+    // recognise options: -fprofile-sample-use= and -fno-profile-sample-use=
+    if (Arg *A = getLastProfileSampleUseArg(Args)) {
+
+      auto *PGOArg = Args.getLastArg(options::OPT_fprofile_generate,
+                                     options::OPT_fprofile_generate_EQ);
+
+      if (PGOArg) {
----------------
tarunprabhu wrote:

nit: These could probably be combined since PGOArg doesn't seem to be used later.

```suggestion
      if (Args.getLastArg(options::OPT_fprofile_generate,
                                     options::OPT_fprofile_generate_EQ))
```

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


More information about the cfe-commits mailing list