1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/include/llvm/IR/FixedMetadataKinds.def

44 lines
2.0 KiB
Modula-2
Raw Normal View History

/*===-- FixedMetadataKinds.def - Fixed metadata kind IDs -------*- C++ -*-=== *\
|*
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|* See https://llvm.org/LICENSE.txt for license information.
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|*
\*===----------------------------------------------------------------------===*/
#ifndef LLVM_FIXED_MD_KIND
#error "LLVM_FIXED_MD_KIND(EnumID, Name, Value) is not defined."
#endif
LLVM_FIXED_MD_KIND(MD_dbg, "dbg", 0)
LLVM_FIXED_MD_KIND(MD_tbaa, "tbaa", 1)
LLVM_FIXED_MD_KIND(MD_prof, "prof", 2)
LLVM_FIXED_MD_KIND(MD_fpmath, "fpmath", 3)
LLVM_FIXED_MD_KIND(MD_range, "range", 4)
LLVM_FIXED_MD_KIND(MD_tbaa_struct, "tbaa.struct", 5)
LLVM_FIXED_MD_KIND(MD_invariant_load, "invariant.load", 6)
LLVM_FIXED_MD_KIND(MD_alias_scope, "alias.scope", 7)
LLVM_FIXED_MD_KIND(MD_noalias, "noalias", 8)
LLVM_FIXED_MD_KIND(MD_nontemporal, "nontemporal", 9)
LLVM_FIXED_MD_KIND(MD_mem_parallel_loop_access,
"llvm.mem.parallel_loop_access", 10)
LLVM_FIXED_MD_KIND(MD_nonnull, "nonnull", 11)
LLVM_FIXED_MD_KIND(MD_dereferenceable, "dereferenceable", 12)
LLVM_FIXED_MD_KIND(MD_dereferenceable_or_null, "dereferenceable_or_null", 13)
LLVM_FIXED_MD_KIND(MD_make_implicit, "make.implicit", 14)
LLVM_FIXED_MD_KIND(MD_unpredictable, "unpredictable", 15)
LLVM_FIXED_MD_KIND(MD_invariant_group, "invariant.group", 16)
LLVM_FIXED_MD_KIND(MD_align, "align", 17)
LLVM_FIXED_MD_KIND(MD_loop, "llvm.loop", 18)
LLVM_FIXED_MD_KIND(MD_type, "type", 19)
LLVM_FIXED_MD_KIND(MD_section_prefix, "section_prefix", 20)
LLVM_FIXED_MD_KIND(MD_absolute_symbol, "absolute_symbol", 21)
LLVM_FIXED_MD_KIND(MD_associated, "associated", 22)
LLVM_FIXED_MD_KIND(MD_callees, "callees", 23)
LLVM_FIXED_MD_KIND(MD_irr_loop, "irr_loop", 24)
LLVM_FIXED_MD_KIND(MD_access_group, "llvm.access.group", 25)
LLVM_FIXED_MD_KIND(MD_callback, "callback", 26)
LLVM_FIXED_MD_KIND(MD_preserve_access_index, "llvm.preserve.access.index", 27)
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 18:19:50 +02:00
LLVM_FIXED_MD_KIND(MD_misexpect, "misexpect", 28)
Reland: Dead Virtual Function Elimination Remove dead virtual functions from vtables with replaceNonMetadataUsesWith, so that CGProfile metadata gets cleaned up correctly. Original commit message: Currently, it is hard for the compiler to remove unused C++ virtual functions, because they are all referenced from vtables, which are referenced by constructors. This means that if the constructor is called from any live code, then we keep every virtual function in the final link, even if there are no call sites which can use it. This patch allows unused virtual functions to be removed during LTO (and regular compilation in limited circumstances) by using type metadata to match virtual function call sites to the vtable slots they might load from. This information can then be used in the global dead code elimination pass instead of the references from vtables to virtual functions, to more accurately determine which functions are reachable. To make this transformation safe, I have changed clang's code-generation to always load virtual function pointers using the llvm.type.checked.load intrinsic, instead of regular load instructions. I originally tried writing this using clang's existing code-generation, which uses the llvm.type.test and llvm.assume intrinsics after doing a normal load. However, it is possible for optimisations to obscure the relationship between the GEP, load and llvm.type.test, causing GlobalDCE to fail to find virtual function call sites. The existing linkage and visibility types don't accurately describe the scope in which a virtual call could be made which uses a given vtable. This is wider than the visibility of the type itself, because a virtual function call could be made using a more-visible base class. I've added a new !vcall_visibility metadata type to represent this, described in TypeMetadata.rst. The internalization pass and libLTO have been updated to change this metadata when linking is performed. This doesn't currently work with ThinLTO, because it needs to see every call to llvm.type.checked.load in the linkage unit. It might be possible to extend this optimisation to be able to use the ThinLTO summary, as was done for devirtualization, but until then that combination is rejected in the clang driver. To test this, I've written a fuzzer which generates random C++ programs with complex class inheritance graphs, and virtual functions called through object and function pointers of different types. The programs are spread across multiple translation units and DSOs to test the different visibility restrictions. I've also tried doing bootstrap builds of LLVM to test this. This isn't ideal, because only classes in anonymous namespaces can be optimised with -fvisibility=default, and some parts of LLVM (plugins and bugpoint) do not work correctly with -fvisibility=hidden. However, there are only 12 test failures when building with -fvisibility=hidden (and an unmodified compiler), and this change does not cause any new failures for either value of -fvisibility. On the 7 C++ sub-benchmarks of SPEC2006, this gives a geomean code-size reduction of ~6%, over a baseline compiled with "-O2 -flto -fvisibility=hidden -fwhole-program-vtables". The best cases are reductions of ~14% in 450.soplex and 483.xalancbmk, and there are no code size increases. I've also run this on a set of 8 mbed-os examples compiled for Armv7M, which show a geomean size reduction of ~3%, again with no size increases. I had hoped that this would have no effect on performance, which would allow it to awlays be enabled (when using -fwhole-program-vtables). However, the changes in clang to use the llvm.type.checked.load intrinsic are causing ~1% performance regression in the C++ parts of SPEC2006. It should be possible to recover some of this perf loss by teaching optimisations about the llvm.type.checked.load intrinsic, which would make it worth turning this on by default (though it's still dependent on -fwhole-program-vtables). Differential revision: https://reviews.llvm.org/D63932 llvm-svn: 375094
2019-10-17 11:58:57 +02:00
LLVM_FIXED_MD_KIND(MD_vcall_visibility, "vcall_visibility", 29)