[PATCH] D21823: [Driver] Add flags for enabling both types of PGO Instrumentation

David Li via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 9 16:01:23 PDT 2016


davidxl added a comment.

I should have brought it up earlier, but I forgot.    I think a better (and simpler) proposal is to make -fprofile-generate and -fprofile-use turn on IR based PGO.

-fprofile-generate and -fprofile-use options were introduced by Diego (cc'ed) recently for GCC option compatibility. At that time, IR based PGO was not yet ready, so they were made aliases to FE instrumentation options -fprofile-instr-generate and -fprofile-instr-use.    Now I think it is time to make it right.   The documentation only says that these two options are gcc compatible options to control profile generation and use, but does not specify the underlying implementation. It is also likely that Google is the only user of this option. If a user using this option really want FE instrumentation, there is always -fprofile-instr-generate to use.  It also more likely that IR instrumentation is what user wants when using GCC compatible options (as they behave more similarly).


================
Comment at: lib/Driver/Tools.cpp:3493
@@ +3492,3 @@
+  if (PGOOutputArg)
+    if (PGOOutputArg->getOption().matches(
+            options::OPT_fpgo_train_output_EQ))
----------------
Is this check needed?

================
Comment at: lib/Driver/Tools.cpp:3513
@@ +3512,3 @@
+
+  auto *PGOApplyArg =
+      Args.getLastArg(options::OPT_fpgo_apply_EQ, options::OPT_fno_pgo_apply);
----------------
Merge this with ProfileUseArg.


================
Comment at: lib/Driver/Tools.cpp:3531-3532
@@ -3493,1 +3530,4 @@
 
+  if (PGOTrainArg && PGOApplyArg)
+    D.Diag(diag::err_drv_argument_not_allowed_with)
+        << PGOApplyArg->getSpelling() << PGOTrainArg->getSpelling();
----------------
not needed

================
Comment at: lib/Driver/Tools.cpp:3535
@@ +3534,3 @@
+
+  if (PGOApplyArg && ProfileUseArg)
+    D.Diag(diag::err_drv_argument_not_allowed_with)
----------------
not needed

================
Comment at: lib/Driver/Tools.cpp:3539
@@ +3538,3 @@
+
+  if (PGOTrainArg && ProfileUseArg)
+    D.Diag(diag::err_drv_argument_not_allowed_with)
----------------
not needed

================
Comment at: lib/Driver/Tools.cpp:3543
@@ -3494,2 +3542,3 @@
+
   if (ProfileGenerateArg && ProfileUseArg)
     D.Diag(diag::err_drv_argument_not_allowed_with)
----------------
if ((ProfileGenerateArg || ProfileTrainArg) && ProfileUseArg)

================
Comment at: lib/Driver/Tools.cpp:3568
@@ +3567,3 @@
+
+  if (PGOApplyArg) {
+    if (PGOApplyArg->getOption().matches(options::OPT_fpgo_apply_EQ))
----------------
Not needed.


Repository:
  rL LLVM

http://reviews.llvm.org/D21823





More information about the cfe-commits mailing list