[llvm] c5ec889 - [NFC] Try fix ubsan buildbot after 876d13378931bee3dcefafff8729c40d5457ff31
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 08:53:23 PST 2020
Author: Tyker
Date: 2020-03-03T17:53:02+01:00
New Revision: c5ec8890c95bf9f56beff285efbcc7b797ffb15a
URL: https://github.com/llvm/llvm-project/commit/c5ec8890c95bf9f56beff285efbcc7b797ffb15a
DIFF: https://github.com/llvm/llvm-project/commit/c5ec8890c95bf9f56beff285efbcc7b797ffb15a.diff
LOG: [NFC] Try fix ubsan buildbot after 876d13378931bee3dcefafff8729c40d5457ff31
Added:
Modified:
llvm/include/llvm/IR/Attributes.h
llvm/include/llvm/Transforms/Utils/KnowledgeRetention.h
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index 3871db9a200e..c8d6db66c36a 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -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:
diff --git a/llvm/include/llvm/Transforms/Utils/KnowledgeRetention.h b/llvm/include/llvm/Transforms/Utils/KnowledgeRetention.h
index c3baf8a43c0d..fcc0dae76fe1 100644
--- a/llvm/include/llvm/Transforms/Utils/KnowledgeRetention.h
+++ b/llvm/include/llvm/Transforms/Utils/KnowledgeRetention.h
@@ -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);
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 0d2435932888..de2a6b47e6e2 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -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;
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
index e72e17f495af..d026e4793b15 100644
--- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -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:
More information about the llvm-commits
mailing list