[NFC] Try fix ubsan buildbot after 876d133789

This commit is contained in:
Tyker 2020-03-03 17:42:57 +01:00
parent 388bccb013
commit c5ec8890c9
4 changed files with 9 additions and 5 deletions

View File

@ -73,7 +73,9 @@ public:
#define GET_ATTR_NAMES
#define ATTRIBUTE_ENUM(ENUM_NAME, OTHER) ENUM_NAME,
#include "llvm/IR/Attributes.inc"
EndAttrKinds ///< Sentinal value useful for loops
EndAttrKinds, ///< Sentinal value useful for loops
EmptyKey, ///< Use as Empty key for DenseMap of AttrKind
TombstoneKey, ///< Use as Tombstone key for DenseMap of AttrKind
};
private:

View File

@ -60,13 +60,11 @@ inline bool hasAttributeInAssume(CallInst &AssumeCI, Value *IsOn,
}
template<> struct DenseMapInfo<Attribute::AttrKind> {
static constexpr auto MaxValue = std::numeric_limits<
std::underlying_type<Attribute::AttrKind>::type>::max();
static Attribute::AttrKind getEmptyKey() {
return static_cast<Attribute::AttrKind>(MaxValue);
return Attribute::EmptyKey;
}
static Attribute::AttrKind getTombstoneKey() {
return static_cast<Attribute::AttrKind>(MaxValue - 1);
return Attribute::TombstoneKey;
}
static unsigned getHashValue(Attribute::AttrKind AK) {
return hash_combine(AK);

View File

@ -1218,6 +1218,8 @@ StructType *BitcodeReader::createIdentifiedStructType(LLVMContext &Context) {
static uint64_t getRawAttributeMask(Attribute::AttrKind Val) {
switch (Val) {
case Attribute::EndAttrKinds:
case Attribute::EmptyKey:
case Attribute::TombstoneKey:
llvm_unreachable("Synthetic enumerators which should never get here");
case Attribute::None: return 0;

View File

@ -887,6 +887,8 @@ Function *CodeExtractor::constructFunction(const ValueSet &inputs,
case Attribute::ZExt:
case Attribute::ImmArg:
case Attribute::EndAttrKinds:
case Attribute::EmptyKey:
case Attribute::TombstoneKey:
continue;
// Those attributes should be safe to propagate to the extracted function.
case Attribute::AlwaysInline: