[PATCH] D35384: PGOInstrumentation: Move profile matching warnings to remarks

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 13:56:39 PDT 2017


dblaikie created this revision.

These messages are expected if the source code has diverged sufficiently
from the code the profile was gathered from. In small enough amounts
they're benign/not actionable, so a warning seems inappropriate/noisy (&
probablematic in -Werror builds) for these kinds of messages.

I also updated some tests around other profile instrumentation related
diagnostics to ensure they are errors (things like failing to load the
profile, finding it's the wrong kind of profile - these are actionable
by the user) & removed one that wasn't reachable/testable, but was
testing an API invariant - replaced that with an assertion.


https://reviews.llvm.org/D35384

Files:
  lib/Transforms/Instrumentation/PGOInstrumentation.cpp
  test/Transforms/PGOProfile/diag_FE_profile.ll
  test/Transforms/PGOProfile/diag_mismatch.ll
  test/Transforms/PGOProfile/diag_no_funcprofdata.ll


Index: test/Transforms/PGOProfile/diag_no_funcprofdata.ll
===================================================================
--- test/Transforms/PGOProfile/diag_no_funcprofdata.ll
+++ test/Transforms/PGOProfile/diag_no_funcprofdata.ll
@@ -5,7 +5,7 @@
 ; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DEFAULT
 ; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DEFAULT
 
-; CHECK: No profile data available for function bar
+; CHECK: remark: <stdin>: No profile data available for function bar
 ; DEFAULT-NOT: No profile data available for function bar
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
Index: test/Transforms/PGOProfile/diag_mismatch.ll
===================================================================
--- test/Transforms/PGOProfile/diag_mismatch.ll
+++ test/Transforms/PGOProfile/diag_mismatch.ll
@@ -2,7 +2,7 @@
 ; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s
 ; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s
 
-; CHECK: Function control flow change detected (hash mismatch) foo
+; CHECK: remark: <stdin>: Function control flow change detected (hash mismatch) foo
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
Index: test/Transforms/PGOProfile/diag_FE_profile.ll
===================================================================
--- test/Transforms/PGOProfile/diag_FE_profile.ll
+++ test/Transforms/PGOProfile/diag_FE_profile.ll
@@ -2,7 +2,7 @@
 ; RUN: not opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S  2>&1 | FileCheck %s
 ; RUN: not opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S  2>&1 | FileCheck %s
 
-; CHECK: Not an IR level instrumentation profile
+; CHECK: error: {{.*}}.profdata: Not an IR level instrumentation profile
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
Index: lib/Transforms/Instrumentation/PGOInstrumentation.cpp
===================================================================
--- lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -956,7 +956,7 @@
 
       std::string Msg = IPE.message() + std::string(" ") + F.getName().str();
       Ctx.diagnose(
-          DiagnosticInfoPGOProfile(M->getName().data(), Msg, DS_Warning));
+          DiagnosticInfoPGOProfile(M->getName().data(), Msg, DS_Remark));
     });
     return false;
   }
@@ -1346,11 +1346,7 @@
 
   std::unique_ptr<IndexedInstrProfReader> PGOReader =
       std::move(ReaderOrErr.get());
-  if (!PGOReader) {
-    Ctx.diagnose(DiagnosticInfoPGOProfile(ProfileFileName.data(),
-                                          StringRef("Cannot get PGOReader")));
-    return false;
-  }
+  assert(PGOReader);
   // TODO: might need to change the warning once the clang option is finalized.
   if (!PGOReader->isIRLevelProfile()) {
     Ctx.diagnose(DiagnosticInfoPGOProfile(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35384.106526.patch
Type: text/x-patch
Size: 3127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170713/e112a88b/attachment.bin>


More information about the llvm-commits mailing list