[PATCH] D22608: [Profile] Use a flag to enable PGO rather than the profraw filename.

Jake VanAdrighem via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 20 20:32:44 PDT 2016


jakev created this revision.
jakev added reviewers: xur, davidxl, silvas.
jakev added a subscriber: cfe-commits.
jakev set the repository for this revision to rL LLVM.

Enable instrumentation using a flag rather than the profile filename.

This is the other half of:
https://reviews.llvm.org/D22607

Repository:
  rL LLVM

https://reviews.llvm.org/D22608

Files:
  lib/CodeGen/BackendUtil.cpp
  test/Profile/gcc-flag-compatibility.c

Index: test/Profile/gcc-flag-compatibility.c
===================================================================
--- test/Profile/gcc-flag-compatibility.c
+++ test/Profile/gcc-flag-compatibility.c
@@ -7,11 +7,10 @@
 // -fprofile-use=<dir>        Uses the profile file <dir>/default.profdata
 // -fprofile-use=<dir>/file   Uses the profile file <dir>/file
 
-// FIXME: IRPGO shouldn't use the override API when no profraw name is given.
-// Check that -fprofile-generate overrides the default profraw.
+// Check that -fprofile-generate doesn't use the override API.
 // RUN: %clang %s -c -S -o - -emit-llvm -fprofile-generate | FileCheck -check-prefix=PROFILE-GEN %s
-// PROFILE-GEN: call void @__llvm_profile_override_default_filename
-// PROFILE-GEN: declare void @__llvm_profile_override_default_filename(i8*)
+// PROFILE-GEN-NOT: call void @__llvm_profile_override_default_filename
+// PROFILE-GEN-NOT: declare void @__llvm_profile_override_default_filename(i8*)
 
 // Check that -fprofile-generate=/path/to generates /path/to/default.profraw
 // RUN: %clang %s -c -S -o - -emit-llvm -fprofile-generate=/path/to | FileCheck -check-prefix=PROFILE-GEN-EQ %s
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -453,10 +453,9 @@
     MPM.add(createInstrProfilingLegacyPass(Options));
   }
   if (CodeGenOpts.hasProfileIRInstr()) {
+    PMBuilder.EnablePGOInstrGen = true;
     if (!CodeGenOpts.InstrProfileOutput.empty())
       PMBuilder.PGOInstrGen = CodeGenOpts.InstrProfileOutput;
-    else
-      PMBuilder.PGOInstrGen = "default.profraw";
   }
   if (CodeGenOpts.hasProfileIRUse())
     PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22608.64812.patch
Type: text/x-patch
Size: 1773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160721/e8b3640d/attachment.bin>


More information about the cfe-commits mailing list