[PATCH] D67253: clang-misexpect: a standalone tool for verifying the use of __builtin_expect with PGO data
Paul Kirth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 5 20:11:12 PDT 2019
paulkirth created this revision.
paulkirth added reviewers: phosek, leonardchan, nickdesaulniers.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya, mgorny.
Herald added projects: clang, LLVM.
This is a continuation of the work in D66324 <https://reviews.llvm.org/D66324> that creates a standalone tool that can simply be run over an entire codebase through the use of a compile commands database. This simplifies the need to support custom build targets to check a project's use of `__builtin_expect()`.
The design is fairly straightforward: use a libTooling executor to walk the compilation database, and run the compiler over each target after curating some compiler flags. Mainly, we remove any incompatible flags, and then configure the codegen options to support using the selected type of profile data. We also process the LLVMArgs, as libTooling executors seem to bypass the normal mechanisms for passing flags to the LLVM backend. Other than these few changes we rely on the existing compiler infrastructure to generate our diagnostics.
Currently the use of the `CodeGenAction` with the libTooling Executor seems to be surfacing some race conditions within the compiler infrastructure. For now I plan to limit the concurrency of the executor to run single threaded, but eventually, I would like to have this run with full parallelism. If a `CodeGenAction` can never be safely run in parallel, then it may become necessary to use an external driver script, similar to `run_clang_tidy.py` to take advantage of parallelism.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D67253
Files:
clang-tools-extra/CMakeLists.txt
clang-tools-extra/clang-misexpect/CMakeLists.txt
clang-tools-extra/clang-misexpect/ClangMisExpect.cpp
clang-tools-extra/clang-misexpect/ClangMisExpect.h
clang-tools-extra/clang-misexpect/tool/CMakeLists.txt
clang-tools-extra/clang-misexpect/tool/ClangMisExpectMain.cpp
clang/cmake/caches/Fuchsia-stage2.cmake
llvm/lib/Transforms/Utils/MisExpect.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67253.219021.patch
Type: text/x-patch
Size: 13241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190906/f8e885df/attachment-0001.bin>
More information about the cfe-commits
mailing list