Skip to content

Commit

Permalink
[NFC] Try fix ubsan buildbot after 876d133
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralender committed Mar 3, 2020
1 parent 388bccb commit c5ec889
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion llvm/include/llvm/IR/Attributes.h
Expand Up @@ -73,7 +73,9 @@ class Attribute {
#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:
Expand Down
6 changes: 2 additions & 4 deletions llvm/include/llvm/Transforms/Utils/KnowledgeRetention.h
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Transforms/Utils/CodeExtractor.cpp
Expand Up @@ -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:
Expand Down

0 comments on commit c5ec889

Please sign in to comment.