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

Address Mehdi's post-commit review comments on r294795.

llvm-svn: 294822
This commit is contained in:
Peter Collingbourne 2017-02-11 03:19:22 +00:00
parent 3bbd6ed985
commit fd1115698d
2 changed files with 55 additions and 29 deletions

View File

@ -251,7 +251,8 @@ public:
/// An "identifier" for a virtual function. This contains the type identifier
/// represented as a GUID and the offset from the address point to the virtual
/// function pointer.
/// function pointer, where "address point" is as defined in the Itanium ABI:
/// https://mentorembedded.github.io/cxx-abi/abi.html#vtable-general
struct VFuncId {
GlobalValue::GUID GUID;
uint64_t Offset;
@ -273,19 +274,26 @@ private:
/// List of <CalleeValueInfo, CalleeInfo> call edge pairs from this function.
std::vector<EdgeTy> CallGraphEdgeList;
/// List of type identifiers used by this function in llvm.type.test
/// intrinsics other than by an llvm.assume intrinsic, represented as GUIDs.
std::vector<GlobalValue::GUID> TypeTests;
/// All type identifier related information. Because these fields are
/// relatively uncommon we only allocate space for them if necessary.
struct TypeIdInfo {
/// List of type identifiers used by this function in llvm.type.test
/// intrinsics other than by an llvm.assume intrinsic, represented as GUIDs.
std::vector<GlobalValue::GUID> TypeTests;
/// List of virtual calls made by this function using (respectively)
/// llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics that do
/// not have all constant integer arguments.
std::vector<VFuncId> TypeTestAssumeVCalls, TypeCheckedLoadVCalls;
/// List of virtual calls made by this function using (respectively)
/// llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics that do
/// not have all constant integer arguments.
std::vector<VFuncId> TypeTestAssumeVCalls, TypeCheckedLoadVCalls;
/// List of virtual calls made by this function using (respectively)
/// llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics with
/// all constant integer arguments.
std::vector<ConstVCall> TypeTestAssumeConstVCalls, TypeCheckedLoadConstVCalls;
/// List of virtual calls made by this function using (respectively)
/// llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics with
/// all constant integer arguments.
std::vector<ConstVCall> TypeTestAssumeConstVCalls,
TypeCheckedLoadConstVCalls;
};
std::unique_ptr<TypeIdInfo> TIdInfo;
public:
/// Summary constructors.
@ -297,12 +305,16 @@ public:
std::vector<ConstVCall> TypeTestAssumeConstVCalls,
std::vector<ConstVCall> TypeCheckedLoadConstVCalls)
: GlobalValueSummary(FunctionKind, Flags, std::move(Refs)),
InstCount(NumInsts), CallGraphEdgeList(std::move(CGEdges)),
TypeTests(std::move(TypeTests)),
TypeTestAssumeVCalls(std::move(TypeTestAssumeVCalls)),
TypeCheckedLoadVCalls(std::move(TypeCheckedLoadVCalls)),
TypeTestAssumeConstVCalls(std::move(TypeTestAssumeConstVCalls)),
TypeCheckedLoadConstVCalls(std::move(TypeCheckedLoadConstVCalls)) {}
InstCount(NumInsts), CallGraphEdgeList(std::move(CGEdges)) {
if (!TypeTests.empty() || !TypeTestAssumeVCalls.empty() ||
!TypeCheckedLoadVCalls.empty() || !TypeTestAssumeConstVCalls.empty() ||
!TypeCheckedLoadConstVCalls.empty())
TIdInfo = llvm::make_unique<TypeIdInfo>(TypeIdInfo{
std::move(TypeTests), std::move(TypeTestAssumeVCalls),
std::move(TypeCheckedLoadVCalls),
std::move(TypeTestAssumeConstVCalls),
std::move(TypeCheckedLoadConstVCalls)});
}
/// Check if this is a function summary.
static bool classof(const GlobalValueSummary *GVS) {
@ -318,41 +330,51 @@ public:
/// Returns the list of type identifiers used by this function in
/// llvm.type.test intrinsics other than by an llvm.assume intrinsic,
/// represented as GUIDs.
ArrayRef<GlobalValue::GUID> type_tests() const { return TypeTests; }
ArrayRef<GlobalValue::GUID> type_tests() const {
if (TIdInfo)
return TIdInfo->TypeTests;
return {};
}
/// Returns the list of virtual calls made by this function using
/// llvm.assume(llvm.type.test) intrinsics that do not have all constant
/// integer arguments.
ArrayRef<VFuncId> type_test_assume_vcalls() const {
return TypeTestAssumeVCalls;
if (TIdInfo)
return TIdInfo->TypeTestAssumeVCalls;
return {};
}
/// Returns the list of virtual calls made by this function using
/// llvm.type.checked.load intrinsics that do not have all constant integer
/// arguments.
ArrayRef<VFuncId> type_checked_load_vcalls() const {
return TypeCheckedLoadVCalls;
if (TIdInfo)
return TIdInfo->TypeCheckedLoadVCalls;
return {};
}
/// Returns the list of virtual calls made by this function using
/// llvm.assume(llvm.type.test) intrinsics with all constant integer
/// arguments.
ArrayRef<ConstVCall> type_test_assume_const_vcalls() const {
return TypeTestAssumeConstVCalls;
if (TIdInfo)
return TIdInfo->TypeTestAssumeConstVCalls;
return {};
}
/// Returns the list of virtual calls made by this function using
/// llvm.type.checked.load intrinsics with all constant integer arguments.
ArrayRef<ConstVCall> type_checked_load_const_vcalls() const {
return TypeCheckedLoadConstVCalls;
if (TIdInfo)
return TIdInfo->TypeCheckedLoadConstVCalls;
return {};
}
};
template <> struct DenseMapInfo<FunctionSummary::VFuncId> {
static inline FunctionSummary::VFuncId getEmptyKey() {
return {0, uint64_t(-1)};
}
static inline FunctionSummary::VFuncId getTombstoneKey() {
static FunctionSummary::VFuncId getEmptyKey() { return {0, uint64_t(-1)}; }
static FunctionSummary::VFuncId getTombstoneKey() {
return {0, uint64_t(-2)};
}
static bool isEqual(FunctionSummary::VFuncId L, FunctionSummary::VFuncId R) {
@ -362,10 +384,10 @@ template <> struct DenseMapInfo<FunctionSummary::VFuncId> {
};
template <> struct DenseMapInfo<FunctionSummary::ConstVCall> {
static inline FunctionSummary::ConstVCall getEmptyKey() {
static FunctionSummary::ConstVCall getEmptyKey() {
return {{0, uint64_t(-1)}, {}};
}
static inline FunctionSummary::ConstVCall getTombstoneKey() {
static FunctionSummary::ConstVCall getTombstoneKey() {
return {{0, uint64_t(-2)}, {}};
}
static bool isEqual(FunctionSummary::ConstVCall L,

View File

@ -4847,6 +4847,10 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(
// "OriginalName" attachement.
GlobalValueSummary *LastSeenSummary = nullptr;
bool Combined = false;
// We can expect to see any number of type ID information records before
// each function summary records; these variables store the information
// collected so far so that it can be used to create the summary object.
std::vector<GlobalValue::GUID> PendingTypeTests;
std::vector<FunctionSummary::VFuncId> PendingTypeTestAssumeVCalls,
PendingTypeCheckedLoadVCalls;