llvm-project/clang/test
Petr Hosek 7bdad08429 Reland "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM"
This patch contains the basic functionality for reporting potentially
incorrect usage of __builtin_expect() by comparing the developer's
annotation against a collected PGO profile. A more detailed proposal and
discussion appears on the CFE-dev mailing list
(http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a
prototype of the initial frontend changes appear here in D65300

We revised the work in D65300 by moving the misexpect check into the
LLVM backend, and adding support for IR and sampling based profiles, in
addition to frontend instrumentation.

We add new misexpect metadata tags to those instructions directly
influenced by the llvm.expect intrinsic (branch, switch, and select)
when lowering the intrinsics. The misexpect metadata contains
information about the expected target of the intrinsic so that we can
check against the correct PGO counter when emitting diagnostics, and the
compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight.
We use these branch weight values to determine when to emit the
diagnostic to the user.

A future patch should address the comment at the top of
LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and
UnlikelyBranchWeight values into a shared space that can be accessed
outside of the LowerExpectIntrinsic pass. Once that is done, the
misexpect metadata can be updated to be smaller.

In the long term, it is possible to reconstruct portions of the
misexpect metadata from the existing profile data. However, we have
avoided this to keep the code simple, and because some kind of metadata
tag will be required to identify which branch/switch/select instructions
are influenced by the use of llvm.expect

Patch By: paulkirth
Differential Revision: https://reviews.llvm.org/D66324

llvm-svn: 371635
2019-09-11 16:19:50 +00:00
..
ARCMT
AST Generate parent context id from Decl* instead of DeclContext*. 2019-09-04 20:30:00 +00:00
ASTMerge Give the 'signed/unsigned wchar_t' extension a warning flag, and follow 2019-07-29 20:00:46 +00:00
Analysis Re-land Remove REQUIRES:shell from tests that pass for me on Windows 2019-09-10 20:15:45 +00:00
CXX [c++20] P1143R2: Add support for the C++20 'constinit' keyword. 2019-09-04 20:30:37 +00:00
ClangScanDeps [clang-scan-deps][NFC] Fix tests - prevent FileCheck matching test dir path 2019-09-11 00:30:26 +00:00
CodeCompletion Re-land "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods." 2019-06-10 15:17:52 +00:00
CodeGen [CodeGen] Add alias for cpu_dispatch function with IFunc & Fix resolver linkage type 2019-09-11 01:54:48 +00:00
CodeGenCUDA [AMDGPU] Set default flat work group size to (1,256) for HIP 2019-09-03 18:50:24 +00:00
CodeGenCXX [CodeGen] Add alias for cpu_dispatch function with IFunc & Fix resolver linkage type 2019-09-11 01:54:48 +00:00
CodeGenCoroutines Remove unreachable blocks before splitting a coroutine. 2019-08-14 03:54:13 +00:00
CodeGenObjC [Sema] Diagnose default-initialization, destruction, and copying of 2019-09-07 00:34:43 +00:00
CodeGenObjCXX [c++20] Implement semantic restrictions for C++20 designated 2019-08-30 22:52:55 +00:00
CodeGenOpenCL AMDGPU: Add builtins for is_shared/is_private 2019-09-05 03:00:43 +00:00
CodeGenOpenCLCXX Make the CXXABIs respect the target's default calling convention. 2019-07-26 12:36:12 +00:00
Coverage Re-check in clang support gun asm goto after fixing tests. 2019-06-03 15:57:25 +00:00
CoverageMapping Remove cache for macro arg stringization 2019-07-30 17:58:22 +00:00
Driver [ARM] Take into account -mcpu and -mfpu options while handling 'crypto' feature 2019-09-11 09:06:17 +00:00
FixIt [c++20] P1143R2: Add support for the C++20 'constinit' keyword. 2019-09-04 20:30:37 +00:00
Format Re-land Remove REQUIRES:shell from tests that pass for me on Windows 2019-09-10 20:15:45 +00:00
Frontend Re-land Remove REQUIRES:shell from tests that pass for me on Windows 2019-09-10 20:15:45 +00:00
Headers [PowerPC] [Clang] Port SSE3, SSSE3 and SSE4 intrinsics to PowerPC 2019-08-09 03:39:55 +00:00
Import
Index Actually reorder not and env in crash-recovery-modules.m 2019-09-10 21:54:16 +00:00
Integration
InterfaceStubs [clang][ifs] Dropping older experimental interface stub formats. 2019-08-22 23:44:34 +00:00
Layout P0840R2: support for [[no_unique_address]] attribute 2019-06-20 20:44:45 +00:00
Lexer [c++20] P1143R2: Add support for the C++20 'constinit' keyword. 2019-09-04 20:30:37 +00:00
Misc [c++20] P1143R2: Add support for the C++20 'constinit' keyword. 2019-09-04 20:30:37 +00:00
Modules Re-land Remove REQUIRES:shell from tests that pass for me on Windows 2019-09-10 20:15:45 +00:00
OpenMP [OPENMP] Update the diagnosis message for canonical loop form, by Chi 2019-09-11 15:44:06 +00:00
PCH Re-land Remove REQUIRES:shell from tests that pass for me on Windows 2019-09-10 20:15:45 +00:00
Parser Re-land Remove REQUIRES:shell from tests that pass for me on Windows 2019-09-10 20:15:45 +00:00
Preprocessor [RISCV] Default to ilp32d/lp64d in RISC-V Linux 2019-09-10 07:57:36 +00:00
Profile Reland "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM" 2019-09-11 16:19:50 +00:00
Refactor [Tooling] Added DeclStmtClass to ExtractionSemicolonPolicy 2019-08-14 13:37:39 +00:00
Rewriter
Sema [Diagnostics] Add -Wsizeof-array-div 2019-09-11 10:59:47 +00:00
SemaCUDA Renamed and changed the wording of warn_cconv_ignored 2019-07-17 20:41:26 +00:00
SemaCXX PR43242: Fix crash when typo-correcting to an operator() that should not 2019-09-09 23:07:22 +00:00
SemaObjC [Sema][ObjC] Mark C union fields that have non-trivial ObjC ownership 2019-09-07 00:34:47 +00:00
SemaObjCXX [c++20] Implement semantic restrictions for C++20 designated 2019-08-30 22:52:55 +00:00
SemaOpenCL [OpenCL] Add image type handling for builtins 2019-09-05 10:01:24 +00:00
SemaOpenCLCXX Quote the token being diagnosed for C11 extensions. 2019-08-27 13:47:51 +00:00
SemaTemplate Fixes an assertion while instantiating a template with an incomplete typo-corrected type. 2019-09-07 20:14:09 +00:00
TableGen
Templight
Tooling Recommit r363298 "[lit] Disable test on darwin when building shared libs." 2019-06-15 20:09:54 +00:00
Unit
VFS Introduce FileEntryRef and use it when handling includes to report correct dependencies 2019-08-22 18:15:50 +00:00
clang-rename
.clang-format
CMakeLists.txt [Clang][Bundler] Use llvm-objcopy for creating fat object files 2019-08-26 19:48:43 +00:00
TestRunner.sh
cxx-sections.data
lit.cfg.py Improve behavior in the case of stack exhaustion. 2019-08-26 18:18:07 +00:00
lit.site.cfg.py.in Improve behavior in the case of stack exhaustion. 2019-08-26 18:18:07 +00:00
make_test_dirs.pl