================
@@ -497,8 +497,18 @@ static void 
parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
       opts.IsPIE = 1;
   }
 
-  if (args.hasArg(clang::options::OPT_fprofile_generate)) {
-    opts.setProfileInstr(llvm::driver::ProfileInstrKind::ProfileIRInstr);
+  if (const llvm::opt::Arg *a =
----------------
kaviya2510 wrote:

As you mentioned, Clang converts `-fprofile-generate=<dir>` to 
`-fprofile-instrument-path=` in the driver and `-cc1` uses that to set 
`InstrProfileOutput`. Flang currently achieves the same result of setting 
`InstrProfileOutput`, but it handles `-fprofile-generate=<dir>` directly in 
`fc1` instead of using `-fprofile-instrument-path=`

We do have plans to add support for other pgo options such as 
`-fprofile-selected-function-group` and `-fcs-profile-generate`, so it make 
sense to align flang with clang's approach by having the driver forward 
`-fprofile-instrument-path=` to fc1. This would let us reuse the existing 
`Options.td` marshalling infrastructure and keep the frontend logic simpler.

I will mark it as a TODO and handle the refactoring in the future PRs.

https://github.com/llvm/llvm-project/pull/216643
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to