[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 2 11:43:06 PDT 2019

xbolva00 added inline comments.

Comment at: clang/lib/CodeGen/MisExpect.cpp:140-146
+void EmitMisExpectWarning(const CallExpr *Call, CodeGenModule &CGM) {
+  SourceLocation ExprLoc = Call->getBeginLoc();
+  unsigned DiagID = CGM.getDiags().getCustomDiagID(
+      DiagnosticsEngine::Warning, "Current PGO counters disagree with "
+                                  "the use of __builtin_expect().");
+  CGM.getDiags().Report(ExprLoc, DiagID);
paulkirth wrote:
> lebedev.ri wrote:
> > This is rather undescriptive.
> > Can you output some more useful info?
> Do you have a suggestion about what feedback would be more useful?
> My initial thought with the somewhat generic message was to simply point out that this usage looked problematic, and let the developer investigate. I wasn't sure we wanted to expose details of the internal heuristic to the user by reporting the internal thresholds.
Message is currently confusing a bit. I really miss clear info like

“This compiler hint seems to be incorrect according to current PGO counters. Please check the hint if it is still valid and perf-profitable”.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list