[PATCH] D15829: [PGO] Clang Option that enables IR level PGO instrumentation

Rong Xu via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 22 12:00:44 PST 2016


xur marked an inline comment as done.
xur added a comment.

I'll send a revised patch soon.


================
Comment at: lib/CodeGen/CodeGenModule.cpp:150
@@ -149,2 +149,3 @@
 
-  if (!CodeGenOpts.InstrProfileInput.empty()) {
+  if (!CodeGenOpts.hasProfileIRInstr() &&
+      !CodeGenOpts.InstrProfileInput.empty()) {
----------------
davidxl wrote:
> Better to use if (CodeGenOpts.hasProfileClangInstr() && ..)
OK. That would require to insert an extra cc1 option of -profile-instrument=clang for profile-use. And possibly some test case option changes too.

================
Comment at: lib/Driver/Tools.cpp:3201
@@ +3200,3 @@
+// Set the profile kind if it's not the default clang kind.
+static void setProfileKindFlag(ArgStringList &CmdArgs,
+                               std::string ProfileName) {
----------------
davidxl wrote:
> I don't quite like this change in the driver. I think the right thing to do is:
> 
> 1) for profile use case, there is no need to pass -fprofile-instrument=<...> FE option from the driver
> 2) The profileInstrKind determination needs to happen in FE (not driver) by peeking into the passed in profile data.
I'll split off the profile kind detection to a separated patch suggested by Sean.

================
Comment at: test/CodeGen/pgo-instrumentation.c:4
@@ +3,3 @@
+// Ensure Pass PGOInstrumentationGenPass is invoked.
+// RUN: %clang -O2 -c -Xclang -fprofile-instrument=llvm -fprofile-instr-generate %s -mllvm -debug-pass=Structure 2>&1 | FileCheck %s -check-prefix=CHECK-PGOGENPASS-INVOKED-INSTR-GEN
+// CHECK-PGOGENPASS-INVOKED-INSTR-GEN: PGOInstrumentationGenPass
----------------
silvas wrote:
> Use `%clang_cc1` here and elsewhere.
Will do.


http://reviews.llvm.org/D15829





More information about the cfe-commits mailing list