[PATCH] Allow diagnostic handlers to check for optimization remarks.

Diego Novillo dnovillo at google.com
Fri Apr 11 15:02:26 PDT 2014


Hi qcolombet,

When optimization remarks are enabled via the driver flag -Rpass, we
should allow the FE diagnostic handler to check if the given pass name
needs a diagnostic.

We were unconditionally checking the pattern defined in opt's
-pass-remarks flag. This was causing the FE to not emit any diagnostics.

http://reviews.llvm.org/D3362

Files:
  lib/IR/LLVMContext.cpp

Index: lib/IR/LLVMContext.cpp
===================================================================
--- lib/IR/LLVMContext.cpp
+++ lib/IR/LLVMContext.cpp
@@ -160,7 +160,14 @@
                                          const Function &Fn,
                                          const DebugLoc &DLoc,
                                          const Twine &Msg) {
-  if (pImpl->optimizationRemarksEnabledFor(PassName))
+  // Optimization remark diagnostics can be enabled via -Rpass= from
+  // the front end or -pass-remarks= from opt. If there is a
+  // diagnostic handler installed, we defer to it to check whether a
+  // diagnostic should be generated for \p PassName. Otherwise, call
+  // LLVMContextImpl::optimizationRemarksEnabledFor to check the
+  // pattern passed in -pass-remarks.
+  if (pImpl->DiagnosticHandler ||
+      pImpl->optimizationRemarksEnabledFor(PassName))
     diagnose(DiagnosticInfoOptimizationRemark(PassName, Fn, DLoc, Msg));
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3362.1.patch
Type: text/x-patch
Size: 962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140411/6c213f68/attachment.bin>


More information about the llvm-commits mailing list