]> granicus.if.org Git - llvm/commitdiff
Move verbosity check for remarks to the diag handler
authorAdam Nemet <anemet@apple.com>
Wed, 4 Oct 2017 04:26:23 +0000 (04:26 +0000)
committerAdam Nemet <anemet@apple.com>
Wed, 4 Oct 2017 04:26:23 +0000 (04:26 +0000)
Test needs some slight adjustment because we no longer check the existence of
BFI but rather that the actual hotness is set on the remark.  If entry_count
is not set getBlockProfileCount returns None.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314874 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/OptimizationDiagnosticInfo.cpp
lib/IR/LLVMContext.cpp
test/Transforms/Inline/optimization-remarks.ll

index c31de0fc42e7b5f1d45643590b66c0c1781df65f..914ec7829fdc74b4f56ebf7b501c6a557f0ebc76 100644 (file)
@@ -169,10 +169,7 @@ void OptimizationRemarkEmitter::emit(
     auto *P = &OptDiagBase;
     *Out << P;
   }
-  // FIXME: now that IsVerbose is part of DI, filtering for this will be moved
-  // from here to clang.
-  if (!OptDiag.isVerbose() || shouldEmitVerbose())
-    F->getContext().diagnose(OptDiag);
+  F->getContext().diagnose(OptDiag);
 }
 
 OptimizationRemarkEmitterWrapperPass::OptimizationRemarkEmitterWrapperPass()
index 6569695c9963b2aae95e7669e2a220cb6a1d97b0..ead65ecfdb815793c38f196b34a45a0cd6e0d9dc 100644 (file)
@@ -199,8 +199,12 @@ static bool isDiagnosticEnabled(const DiagnosticInfo &DI) {
   // pattern, passed via one of the -pass-remarks* flags, matches the name of
   // the pass that is emitting the diagnostic. If there is no match, ignore the
   // diagnostic and return.
+  //
+  // Also noisy remarks are only enabled if we have hotness information to sort
+  // them.
   if (auto *Remark = dyn_cast<DiagnosticInfoOptimizationBase>(&DI))
-    return Remark->isEnabled();
+    return Remark->isEnabled() &&
+           (!Remark->isVerbose() || Remark->getHotness());
 
   return true;
 }
index 3f8332134e0fdbfa7918d33ac3e81f0b07bbddfa..f554f0812b52693156f38c1dd1fad5db4781f5fc 100644 (file)
@@ -20,7 +20,7 @@
 ; CHECK: foz not inlined into bar because it should never be inlined (cost=never)
 
 ; Function Attrs: alwaysinline nounwind uwtable
-define i32 @foo(i32 %x, i32 %y) #0 {
+define i32 @foo(i32 %x, i32 %y) #0 !prof !1 {
 entry:
   %x.addr = alloca i32, align 4
   %y.addr = alloca i32, align 4
@@ -33,7 +33,7 @@ entry:
 }
 
 ; Function Attrs: noinline nounwind uwtable
-define float @foz(i32 %x, i32 %y) #1 {
+define float @foz(i32 %x, i32 %y) #1 !prof !1 {
 entry:
   %x.addr = alloca i32, align 4
   %y.addr = alloca i32, align 4
@@ -49,7 +49,7 @@ entry:
 declare i32 @fox()
 
 ; Function Attrs: nounwind uwtable
-define i32 @bar(i32 %j) #2 {
+define i32 @bar(i32 %j) #2 !prof !1 {
 entry:
   %j.addr = alloca i32, align 4
   store i32 %j, i32* %j.addr, align 4
@@ -76,3 +76,4 @@ attributes #2 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointe
 !llvm.ident = !{!0}
 
 !0 = !{!"clang version 3.5.0 "}
+!1 = !{!"function_entry_count", i64 10}