[all-commits] [llvm/llvm-project] 60d394: [remark][diagnostics] Using clang diagnostic handl...

xur-llvm via All-commits all-commits at lists.llvm.org
Tue Jan 14 15:45:45 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 60d39479221d6bc09060f7816bcd7c54eb286603
      https://github.com/llvm/llvm-project/commit/60d39479221d6bc09060f7816bcd7c54eb286603
  Author: Rong Xu <xur at google.com>
  Date:   2020-01-14 (Tue, 14 Jan 2020)

  Changed paths:
    M clang/lib/CodeGen/CodeGenAction.cpp
    A clang/test/CodeGen/Inputs/thinlto_expect1.proftext
    A clang/test/CodeGen/Inputs/thinlto_expect2.proftext
    A clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
    M clang/test/CodeGen/thinlto-diagnostic-handler-remarks-with-hotness.ll

  Log Message:
  -----------
  [remark][diagnostics] Using clang diagnostic handler for IR input files

For IR input files, we currently use LLVM diagnostic handler even the
compilation is from clang. As a result, we are not able to use -Rpass
to get the transformation reports. Some warnings are not handled
properly either: We found many mysterious warnings in our ThinLTO backend
compilations in SamplePGO and CSPGO. An example of the warning:
"warning: net/proto2/public/metadata_lite.h:51:21: 0.02% (1 / 4999)"

This turns out to be a warning by Wmisexpect, which is supposed to be
filtered out by default. But since the filter is in clang's
diagnostic hander, we emit these incomplete warnings from LLVM's
diagnostic handler.

This patch uses clang diagnostic handler for IR input files. We create
a fake backendconsumer just to install the diagnostic handler.

With this change, we will have proper handling of all the warnings and we can
use -Rpass* options in IR input files compilation.
Also note that with is patch, LLVM's diagnostic options, like
"-mllvm -pass-remarks=*", are no longer be able to get optimization remarks.

Differential Revision: https://reviews.llvm.org/D72523




More information about the All-commits mailing list