aboutsummaryrefslogtreecommitdiff
path: root/llvm/include
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/ADT/APFloat.h6
-rw-r--r--llvm/include/llvm/ADT/APInt.h3
-rw-r--r--llvm/include/llvm/ADT/BitVector.h6
-rw-r--r--llvm/include/llvm/ADT/GenericSSAContext.h2
-rw-r--r--llvm/include/llvm/ADT/STLExtras.h14
-rw-r--r--llvm/include/llvm/ADT/STLForwardCompat.h10
-rw-r--r--llvm/include/llvm/ADT/StringSwitch.h34
-rw-r--r--llvm/include/llvm/ADT/ilist.h26
-rw-r--r--llvm/include/llvm/ADT/ilist_node_options.h43
-rw-r--r--llvm/include/llvm/Analysis/DDG.h6
-rw-r--r--llvm/include/llvm/Analysis/LoopAccessAnalysis.h2
-rw-r--r--llvm/include/llvm/Analysis/ValueTracking.h10
-rw-r--r--llvm/include/llvm/Bitcode/LLVMBitCodes.h1
-rw-r--r--llvm/include/llvm/CAS/ActionCache.h6
-rw-r--r--llvm/include/llvm/CAS/BuiltinUnifiedCASDatabases.h59
-rw-r--r--llvm/include/llvm/CAS/ObjectStore.h47
-rw-r--r--llvm/include/llvm/CAS/OnDiskGraphDB.h12
-rw-r--r--llvm/include/llvm/CAS/OnDiskKeyValueDB.h15
-rw-r--r--llvm/include/llvm/CAS/UnifiedOnDiskCache.h172
-rw-r--r--llvm/include/llvm/CodeGen/BasicTTIImpl.h49
-rw-r--r--llvm/include/llvm/CodeGen/GlobalMergeFunctions.h2
-rw-r--r--llvm/include/llvm/CodeGen/SelectionDAG.h12
-rw-r--r--llvm/include/llvm/DebugInfo/DIContext.h2
-rw-r--r--llvm/include/llvm/Demangle/Utility.h2
-rw-r--r--llvm/include/llvm/ExecutionEngine/JITLink/aarch32.h2
-rw-r--r--llvm/include/llvm/ExecutionEngine/Orc/MachOBuilder.h2
-rw-r--r--llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h2
-rw-r--r--llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h6
-rw-r--r--llvm/include/llvm/IR/Attributes.td5
-rw-r--r--llvm/include/llvm/IR/DebugProgramInstruction.h2
-rw-r--r--llvm/include/llvm/IR/DroppedVariableStats.h2
-rw-r--r--llvm/include/llvm/IR/Instructions.h5
-rw-r--r--llvm/include/llvm/IR/Intrinsics.td85
-rw-r--r--llvm/include/llvm/IR/IntrinsicsDirectX.td3
-rw-r--r--llvm/include/llvm/IR/IntrinsicsSPIRV.td3
-rw-r--r--llvm/include/llvm/IR/RuntimeLibcalls.h7
-rw-r--r--llvm/include/llvm/IR/TrackingMDRef.h7
-rw-r--r--llvm/include/llvm/MC/MCRegisterInfo.h2
-rw-r--r--llvm/include/llvm/MCA/SourceMgr.h2
-rw-r--r--llvm/include/llvm/ObjCopy/ConfigManager.h2
-rw-r--r--llvm/include/llvm/ObjCopy/MultiFormatConfig.h2
-rw-r--r--llvm/include/llvm/Object/MachO.h2
-rw-r--r--llvm/include/llvm/ObjectYAML/DXContainerYAML.h4
-rw-r--r--llvm/include/llvm/ProfileData/DataAccessProf.h2
-rw-r--r--llvm/include/llvm/SandboxIR/Context.h2
-rw-r--r--llvm/include/llvm/SandboxIR/Instruction.h2
-rw-r--r--llvm/include/llvm/SandboxIR/Pass.h2
-rw-r--r--llvm/include/llvm/SandboxIR/PassManager.h8
-rw-r--r--llvm/include/llvm/Support/Allocator.h2
-rw-r--r--llvm/include/llvm/Support/Atomic.h4
-rw-r--r--llvm/include/llvm/Support/BinaryStreamArray.h8
-rw-r--r--llvm/include/llvm/Support/Chrono.h8
-rw-r--r--llvm/include/llvm/Support/ConvertUTF.h27
-rw-r--r--llvm/include/llvm/Support/DebugCounter.h2
-rw-r--r--llvm/include/llvm/Support/ErrorHandling.h4
-rw-r--r--llvm/include/llvm/Support/FormatVariadicDetails.h4
-rw-r--r--llvm/include/llvm/Support/GenericLoopInfo.h16
-rw-r--r--llvm/include/llvm/Support/GenericLoopInfoImpl.h6
-rw-r--r--llvm/include/llvm/Support/MD5.h2
-rw-r--r--llvm/include/llvm/Support/Mutex.h4
-rw-r--r--llvm/include/llvm/Support/OnDiskHashTable.h32
-rw-r--r--llvm/include/llvm/Support/PointerLikeTypeTraits.h4
-rw-r--r--llvm/include/llvm/Support/Program.h4
-rw-r--r--llvm/include/llvm/Support/RISCVISAUtils.h4
-rw-r--r--llvm/include/llvm/Support/RWMutex.h6
-rw-r--r--llvm/include/llvm/Support/Registry.h4
-rw-r--r--llvm/include/llvm/Support/ScaledNumber.h6
-rw-r--r--llvm/include/llvm/Support/SuffixTree.h2
-rw-r--r--llvm/include/llvm/Support/Threading.h2
-rw-r--r--llvm/include/llvm/Support/TrailingObjects.h6
-rw-r--r--llvm/include/llvm/Support/UnicodeCharRanges.h2
-rw-r--r--llvm/include/llvm/Support/float128.h2
-rw-r--r--llvm/include/llvm/Support/thread.h2
-rw-r--r--llvm/include/llvm/TableGen/CodeGenHelpers.h5
-rw-r--r--llvm/include/llvm/Transforms/IPO/Attributor.h13
75 files changed, 627 insertions, 256 deletions
diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h
index bccdb89..82ac9a3 100644
--- a/llvm/include/llvm/ADT/APFloat.h
+++ b/llvm/include/llvm/ADT/APFloat.h
@@ -152,7 +152,7 @@ public:
static constexpr unsigned integerPartWidth = APInt::APINT_BITS_PER_WORD;
/// A signed type to represent a floating point numbers unbiased exponent.
- typedef int32_t ExponentType;
+ using ExponentType = int32_t;
/// \name Floating Point Semantics.
/// @{
@@ -938,8 +938,8 @@ LLVM_ABI DoubleAPFloat frexp(const DoubleAPFloat &X, int &Exp, roundingMode);
// This is a interface class that is currently forwarding functionalities from
// detail::IEEEFloat.
class APFloat : public APFloatBase {
- typedef detail::IEEEFloat IEEEFloat;
- typedef detail::DoubleAPFloat DoubleAPFloat;
+ using IEEEFloat = detail::IEEEFloat;
+ using DoubleAPFloat = detail::DoubleAPFloat;
static_assert(std::is_standard_layout<IEEEFloat>::value);
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 9fa98ad..fdb3b84 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -77,7 +77,7 @@ inline APInt operator-(APInt);
///
class [[nodiscard]] APInt {
public:
- typedef uint64_t WordType;
+ using WordType = uint64_t;
/// Byte size of a word.
static constexpr unsigned APINT_WORD_SIZE = sizeof(WordType);
@@ -154,6 +154,7 @@ public:
/// Once all uses of this constructor are migrated to other constructors,
/// consider marking this overload ""= delete" to prevent calls from being
/// incorrectly bound to the APInt(unsigned, uint64_t, bool) constructor.
+ [[deprecated("Use other constructors of APInt")]]
LLVM_ABI APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);
/// Construct an APInt from a string representation.
diff --git a/llvm/include/llvm/ADT/BitVector.h b/llvm/include/llvm/ADT/BitVector.h
index 9e81a4b..cc3f3a9 100644
--- a/llvm/include/llvm/ADT/BitVector.h
+++ b/llvm/include/llvm/ADT/BitVector.h
@@ -99,7 +99,7 @@ public:
};
class BitVector {
- typedef uintptr_t BitWord;
+ using BitWord = uintptr_t;
enum { BITWORD_SIZE = (unsigned)sizeof(BitWord) * CHAR_BIT };
@@ -147,8 +147,8 @@ public:
}
};
- typedef const_set_bits_iterator_impl<BitVector> const_set_bits_iterator;
- typedef const_set_bits_iterator set_iterator;
+ using const_set_bits_iterator = const_set_bits_iterator_impl<BitVector>;
+ using set_iterator = const_set_bits_iterator;
const_set_bits_iterator set_bits_begin() const {
return const_set_bits_iterator(*this);
diff --git a/llvm/include/llvm/ADT/GenericSSAContext.h b/llvm/include/llvm/ADT/GenericSSAContext.h
index e9f99ba..426a083 100644
--- a/llvm/include/llvm/ADT/GenericSSAContext.h
+++ b/llvm/include/llvm/ADT/GenericSSAContext.h
@@ -25,7 +25,7 @@ template <typename, bool> class DominatorTreeBase;
template <typename> class SmallVectorImpl;
namespace Intrinsic {
-typedef unsigned ID;
+using ID = unsigned;
}
// Specializations of this template should provide the types used by the
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index a9841c6..af0e4a3 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -1516,8 +1516,8 @@ template <class Iterator, class RNG>
void shuffle(Iterator first, Iterator last, RNG &&g) {
// It would be better to use a std::uniform_int_distribution,
// but that would be stdlib dependent.
- typedef
- typename std::iterator_traits<Iterator>::difference_type difference_type;
+ using difference_type =
+ typename std::iterator_traits<Iterator>::difference_type;
for (auto size = last - first; size > 1; ++first, (void)--size) {
difference_type offset = g() % size;
// Avoid self-assignment due to incorrect assertions in libstdc++
@@ -2600,16 +2600,6 @@ bool hasNItemsOrLess(ContainerTy &&C, unsigned N) {
return hasNItemsOrLess(adl_begin(C), adl_end(C), N);
}
-/// Returns a raw pointer that represents the same address as the argument.
-///
-/// This implementation can be removed once we move to C++20 where it's defined
-/// as std::to_address().
-///
-/// The std::pointer_traits<>::to_address(p) variations of these overloads has
-/// not been implemented.
-template <class Ptr> auto to_address(const Ptr &P) { return P.operator->(); }
-template <class T> constexpr T *to_address(T *P) { return P; }
-
// Detect incomplete types, relying on the fact that their size is unknown.
namespace detail {
template <typename T> using has_sizeof = decltype(sizeof(T));
diff --git a/llvm/include/llvm/ADT/STLForwardCompat.h b/llvm/include/llvm/ADT/STLForwardCompat.h
index e02694f..ad94cde 100644
--- a/llvm/include/llvm/ADT/STLForwardCompat.h
+++ b/llvm/include/llvm/ADT/STLForwardCompat.h
@@ -134,6 +134,16 @@ struct identity // NOLINT(readability-identifier-naming)
}
};
+/// Returns a raw pointer that represents the same address as the argument.
+///
+/// This implementation can be removed once we move to C++20 where it's defined
+/// as std::to_address().
+///
+/// The std::pointer_traits<>::to_address(p) variations of these overloads has
+/// not been implemented.
+template <class Ptr> auto to_address(const Ptr &P) { return P.operator->(); }
+template <class T> constexpr T *to_address(T *P) { return P; }
+
//===----------------------------------------------------------------------===//
// Features from C++23
//===----------------------------------------------------------------------===//
diff --git a/llvm/include/llvm/ADT/StringSwitch.h b/llvm/include/llvm/ADT/StringSwitch.h
index 8c8d31b..53ebec1 100644
--- a/llvm/include/llvm/ADT/StringSwitch.h
+++ b/llvm/include/llvm/ADT/StringSwitch.h
@@ -14,7 +14,6 @@
#define LLVM_ADT_STRINGSWITCH_H
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <cstring>
@@ -42,6 +41,8 @@ namespace llvm {
/// .Cases({"violet", "purple"}, Violet)
/// .Default(UnknownColor);
/// \endcode
+///
+/// When multiple matches are found, the value of the first match is returned.
template<typename T, typename R = T>
class StringSwitch {
/// The string we are matching.
@@ -64,7 +65,7 @@ public:
void operator=(const StringSwitch &) = delete;
void operator=(StringSwitch &&) = delete;
- // Case-sensitive case matchers
+ // Case-sensitive case matchers.
StringSwitch &Case(StringLiteral S, T Value) {
CaseImpl(S, Value);
return *this;
@@ -214,23 +215,30 @@ public:
[[nodiscard]] operator R() { return DefaultUnreachable(); }
private:
- // Returns true when `Str` matches the `S` argument, and stores the result.
+ // Returns true when a match is found. If `Str` matches the `S` argument,
+ // stores the result.
bool CaseImpl(StringLiteral S, T &Value) {
- if (!Result && Str == S) {
- Result = std::move(Value);
+ if (Result)
return true;
- }
- return false;
+
+ if (Str != S)
+ return false;
+
+ Result = std::move(Value);
+ return true;
}
- // Returns true when `Str` matches the `S` argument (case-insensitive), and
- // stores the result.
+ // Returns true when a match is found. If `Str` matches the `S` argument
+ // (case-insensitive), stores the result.
bool CaseLowerImpl(StringLiteral S, T &Value) {
- if (!Result && Str.equals_insensitive(S)) {
- Result = std::move(Value);
+ if (Result)
return true;
- }
- return false;
+
+ if (!Str.equals_insensitive(S))
+ return false;
+
+ Result = std::move(Value);
+ return true;
}
StringSwitch &CasesImpl(std::initializer_list<StringLiteral> Cases,
diff --git a/llvm/include/llvm/ADT/ilist.h b/llvm/include/llvm/ADT/ilist.h
index aed19cc..6439290 100644
--- a/llvm/include/llvm/ADT/ilist.h
+++ b/llvm/include/llvm/ADT/ilist.h
@@ -108,21 +108,21 @@ template <typename Ty> struct ilist_traits<const Ty> {};
/// list.
template <class IntrusiveListT, class TraitsT>
class iplist_impl : public TraitsT, IntrusiveListT {
- typedef IntrusiveListT base_list_type;
+ using base_list_type = IntrusiveListT;
public:
- typedef typename base_list_type::pointer pointer;
- typedef typename base_list_type::const_pointer const_pointer;
- typedef typename base_list_type::reference reference;
- typedef typename base_list_type::const_reference const_reference;
- typedef typename base_list_type::value_type value_type;
- typedef typename base_list_type::size_type size_type;
- typedef typename base_list_type::difference_type difference_type;
- typedef typename base_list_type::iterator iterator;
- typedef typename base_list_type::const_iterator const_iterator;
- typedef typename base_list_type::reverse_iterator reverse_iterator;
- typedef
- typename base_list_type::const_reverse_iterator const_reverse_iterator;
+ using pointer = typename base_list_type::pointer;
+ using const_pointer = typename base_list_type::const_pointer;
+ using reference = typename base_list_type::reference;
+ using const_reference = typename base_list_type::const_reference;
+ using value_type = typename base_list_type::value_type;
+ using size_type = typename base_list_type::size_type;
+ using difference_type = typename base_list_type::difference_type;
+ using iterator = typename base_list_type::iterator;
+ using const_iterator = typename base_list_type::const_iterator;
+ using reverse_iterator = typename base_list_type::reverse_iterator;
+ using const_reverse_iterator =
+ typename base_list_type::const_reverse_iterator;
private:
static bool op_less(const_reference L, const_reference R) { return L < R; }
diff --git a/llvm/include/llvm/ADT/ilist_node_options.h b/llvm/include/llvm/ADT/ilist_node_options.h
index 003d5da..53719b0 100644
--- a/llvm/include/llvm/ADT/ilist_node_options.h
+++ b/llvm/include/llvm/ADT/ilist_node_options.h
@@ -58,8 +58,8 @@ namespace ilist_detail {
template <bool IsExplicit> struct explicitness {
static const bool is_explicit = IsExplicit;
};
-typedef explicitness<true> is_explicit;
-typedef explicitness<false> is_implicit;
+using is_explicit = explicitness<true>;
+using is_implicit = explicitness<false>;
/// Check whether an option is valid.
///
@@ -103,12 +103,12 @@ struct is_valid_option<ilist_sentinel_tracking<EnableSentinelTracking>>
template <class... Options> struct extract_tag;
template <class Tag, class... Options>
struct extract_tag<ilist_tag<Tag>, Options...> {
- typedef Tag type;
+ using type = Tag;
};
template <class Option1, class... Options>
struct extract_tag<Option1, Options...> : extract_tag<Options...> {};
template <> struct extract_tag<> {
- typedef void type;
+ using type = void;
};
template <class Tag> struct is_valid_option<ilist_tag<Tag>> : std::true_type {};
@@ -134,11 +134,13 @@ struct is_valid_option<ilist_iterator_bits<IteratorBits>> : std::true_type {};
template <class... Options> struct extract_parent;
template <class ParentTy, class... Options>
struct extract_parent<ilist_parent<ParentTy>, Options...> {
- typedef ParentTy type;
+ using type = ParentTy;
};
template <class Option1, class... Options>
struct extract_parent<Option1, Options...> : extract_parent<Options...> {};
-template <> struct extract_parent<> { typedef void type; };
+template <> struct extract_parent<> {
+ using type = void;
+};
template <class ParentTy>
struct is_valid_option<ilist_parent<ParentTy>> : std::true_type {};
@@ -154,28 +156,27 @@ struct check_options : std::conjunction<is_valid_option<Options>...> {};
template <class T, bool EnableSentinelTracking, bool IsSentinelTrackingExplicit,
class TagT, bool HasIteratorBits, class ParentTy>
struct node_options {
- typedef T value_type;
- typedef T *pointer;
- typedef T &reference;
- typedef const T *const_pointer;
- typedef const T &const_reference;
+ using value_type = T;
+ using pointer = T *;
+ using reference = T &;
+ using const_pointer = const T *;
+ using const_reference = const T &;
static const bool enable_sentinel_tracking = EnableSentinelTracking;
static const bool is_sentinel_tracking_explicit = IsSentinelTrackingExplicit;
static const bool has_iterator_bits = HasIteratorBits;
- typedef TagT tag;
- typedef ParentTy parent_ty;
- typedef ilist_node_base<enable_sentinel_tracking, parent_ty> node_base_type;
- typedef ilist_base<enable_sentinel_tracking, parent_ty> list_base_type;
+ using tag = TagT;
+ using parent_ty = ParentTy;
+ using node_base_type = ilist_node_base<enable_sentinel_tracking, parent_ty>;
+ using list_base_type = ilist_base<enable_sentinel_tracking, parent_ty>;
};
template <class T, class... Options> struct compute_node_options {
- typedef node_options<T, extract_sentinel_tracking<Options...>::value,
- extract_sentinel_tracking<Options...>::is_explicit,
- typename extract_tag<Options...>::type,
- extract_iterator_bits<Options...>::value,
- typename extract_parent<Options...>::type>
- type;
+ using type = node_options<T, extract_sentinel_tracking<Options...>::value,
+ extract_sentinel_tracking<Options...>::is_explicit,
+ typename extract_tag<Options...>::type,
+ extract_iterator_bits<Options...>::value,
+ typename extract_parent<Options...>::type>;
};
} // end namespace ilist_detail
diff --git a/llvm/include/llvm/Analysis/DDG.h b/llvm/include/llvm/Analysis/DDG.h
index 1c53291..120bb46 100644
--- a/llvm/include/llvm/Analysis/DDG.h
+++ b/llvm/include/llvm/Analysis/DDG.h
@@ -60,11 +60,7 @@ public:
DDGNode(DDGNode &&N) : DDGNodeBase(std::move(N)), Kind(N.Kind) {}
virtual ~DDGNode() = 0;
- DDGNode &operator=(const DDGNode &N) {
- DGNode::operator=(N);
- Kind = N.Kind;
- return *this;
- }
+ DDGNode &operator=(const DDGNode &N) = default;
DDGNode &operator=(DDGNode &&N) {
DGNode::operator=(std::move(N));
diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index 84b4ad7..c85ef3e 100644
--- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -893,7 +893,7 @@ replaceSymbolicStrideSCEV(PredicatedScalarEvolution &PSE,
/// result of this function is undefined.
LLVM_ABI std::optional<int64_t>
getPtrStride(PredicatedScalarEvolution &PSE, Type *AccessTy, Value *Ptr,
- const Loop *Lp,
+ const Loop *Lp, const DominatorTree &DT,
const DenseMap<Value *, const SCEV *> &StridesMap =
DenseMap<Value *, const SCEV *>(),
bool Assume = false, bool ShouldCheckWrap = true);
diff --git a/llvm/include/llvm/Analysis/ValueTracking.h b/llvm/include/llvm/Analysis/ValueTracking.h
index af218ba..093309c 100644
--- a/llvm/include/llvm/Analysis/ValueTracking.h
+++ b/llvm/include/llvm/Analysis/ValueTracking.h
@@ -1024,6 +1024,16 @@ findValuesAffectedByCondition(Value *Cond, bool IsAssume,
LLVM_ABI Value *stripNullTest(Value *V);
LLVM_ABI const Value *stripNullTest(const Value *V);
+/// Enumerates all possible values of V and inserts them into the set \p
+/// Constants. If \p AllowUndefOrPoison is false, it fails when V may contain
+/// undef/poison elements. Returns true if the result is complete. Otherwise,
+/// the result is incomplete (more than MaxCount values).
+/// NOTE: The constant values are not distinct.
+LLVM_ABI bool
+collectPossibleValues(const Value *V,
+ SmallPtrSetImpl<const Constant *> &Constants,
+ unsigned MaxCount, bool AllowUndefOrPoison = true);
+
} // end namespace llvm
#endif // LLVM_ANALYSIS_VALUETRACKING_H
diff --git a/llvm/include/llvm/Bitcode/LLVMBitCodes.h b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
index 464f475..b0c5bea 100644
--- a/llvm/include/llvm/Bitcode/LLVMBitCodes.h
+++ b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
@@ -801,6 +801,7 @@ enum AttributeKindCodes {
ATTR_KIND_CAPTURES = 102,
ATTR_KIND_DEAD_ON_RETURN = 103,
ATTR_KIND_SANITIZE_ALLOC_TOKEN = 104,
+ ATTR_KIND_NO_CREATE_UNDEF_OR_POISON = 105,
};
enum ComdatSelectionKindCodes {
diff --git a/llvm/include/llvm/CAS/ActionCache.h b/llvm/include/llvm/CAS/ActionCache.h
index 69ee4dd..7f5b112 100644
--- a/llvm/include/llvm/CAS/ActionCache.h
+++ b/llvm/include/llvm/CAS/ActionCache.h
@@ -75,6 +75,9 @@ public:
CanBeDistributed);
}
+ /// Validate the ActionCache contents.
+ virtual Error validate() const = 0;
+
virtual ~ActionCache() = default;
protected:
@@ -97,6 +100,9 @@ private:
/// Create an action cache in memory.
std::unique_ptr<ActionCache> createInMemoryActionCache();
+/// Create an action cache on disk.
+Expected<std::unique_ptr<ActionCache>> createOnDiskActionCache(StringRef Path);
+
} // end namespace llvm::cas
#endif // LLVM_CAS_ACTIONCACHE_H
diff --git a/llvm/include/llvm/CAS/BuiltinUnifiedCASDatabases.h b/llvm/include/llvm/CAS/BuiltinUnifiedCASDatabases.h
new file mode 100644
index 0000000..6c165c4
--- /dev/null
+++ b/llvm/include/llvm/CAS/BuiltinUnifiedCASDatabases.h
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_CAS_BUILTINUNIFIEDCASDATABASES_H
+#define LLVM_CAS_BUILTINUNIFIEDCASDATABASES_H
+
+#include "llvm/Support/Error.h"
+
+namespace llvm::cas {
+
+class ActionCache;
+class ObjectStore;
+
+/// Create on-disk \c ObjectStore and \c ActionCache instances based on
+/// \c ondisk::UnifiedOnDiskCache, with built-in hashing.
+Expected<std::pair<std::unique_ptr<ObjectStore>, std::unique_ptr<ActionCache>>>
+createOnDiskUnifiedCASDatabases(StringRef Path);
+
+/// Represents the result of validating the contents using
+/// \c validateOnDiskUnifiedCASDatabasesIfNeeded.
+///
+/// Note: invalid results are handled as an \c Error.
+enum class ValidationResult {
+ /// The data is already valid.
+ Valid,
+ /// The data was invalid, but was recovered.
+ Recovered,
+ /// Validation was skipped, as it was not needed.
+ Skipped,
+};
+
+/// Validate the data in \p Path, if needed to ensure correctness.
+///
+/// \param Path directory for the on-disk database.
+/// \param CheckHash Whether to validate hashes match the data.
+/// \param AllowRecovery Whether to automatically recover from invalid data by
+/// marking the files for garbage collection.
+/// \param ForceValidation Whether to force validation to occur even if it
+/// should not be necessary.
+/// \param LLVMCasBinaryPath If provided, validation is performed out-of-process
+/// using the given \c llvm-cas executable which protects against crashes
+/// during validation. Otherwise validation is performed in-process.
+///
+/// \returns \c Valid if the data is already valid, \c Recovered if data
+/// was invalid but has been cleared, \c Skipped if validation is not needed,
+/// or an \c Error if validation cannot be performed or if the data is left
+/// in an invalid state because \p AllowRecovery is false.
+Expected<ValidationResult> validateOnDiskUnifiedCASDatabasesIfNeeded(
+ StringRef Path, bool CheckHash, bool AllowRecovery, bool ForceValidation,
+ std::optional<StringRef> LLVMCasBinaryPath);
+
+} // namespace llvm::cas
+
+#endif // LLVM_CAS_BUILTINUNIFIEDCASDATABASES_H
diff --git a/llvm/include/llvm/CAS/ObjectStore.h b/llvm/include/llvm/CAS/ObjectStore.h
index 6db5dd3..29950fe 100644
--- a/llvm/include/llvm/CAS/ObjectStore.h
+++ b/llvm/include/llvm/CAS/ObjectStore.h
@@ -5,6 +5,11 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains the declaration of the ObjectStore class.
+///
+//===----------------------------------------------------------------------===//
#ifndef LLVM_CAS_OBJECTSTORE_H
#define LLVM_CAS_OBJECTSTORE_H
@@ -111,7 +116,10 @@ public:
virtual Expected<bool> isMaterialized(ObjectRef Ref) const = 0;
/// Validate the underlying object referred by CASID.
- virtual Error validate(const CASID &ID) = 0;
+ virtual Error validateObject(const CASID &ID) = 0;
+
+ /// Validate the entire ObjectStore.
+ virtual Error validate(bool CheckHash) const = 0;
protected:
/// Load the object referenced by \p Ref.
@@ -215,9 +223,39 @@ public:
return Data.size();
}
+ /// Set the size for limiting growth of on-disk storage. This has an effect
+ /// for when the instance is closed.
+ ///
+ /// Implementations may leave this unimplemented.
+ virtual Error setSizeLimit(std::optional<uint64_t> SizeLimit) {
+ return Error::success();
+ }
+
+ /// \returns the storage size of the on-disk CAS data.
+ ///
+ /// Implementations that don't have an implementation for this should return
+ /// \p std::nullopt.
+ virtual Expected<std::optional<uint64_t>> getStorageSize() const {
+ return std::nullopt;
+ }
+
+ /// Prune local storage to reduce its size according to the desired size
+ /// limit. Pruning can happen concurrently with other operations.
+ ///
+ /// Implementations may leave this unimplemented.
+ virtual Error pruneStorageData() { return Error::success(); }
+
/// Validate the whole node tree.
Error validateTree(ObjectRef Ref);
+ /// Import object from another CAS. This will import the full tree from the
+ /// other CAS.
+ Expected<ObjectRef> importObject(ObjectStore &Upstream, ObjectRef Other);
+
+ /// Print the ObjectStore internals for debugging purpose.
+ virtual void print(raw_ostream &) const {}
+ void dump() const;
+
/// Get CASContext
const CASContext &getContext() const { return Context; }
@@ -290,8 +328,15 @@ private:
ObjectHandle H;
};
+/// Create an in memory CAS.
std::unique_ptr<ObjectStore> createInMemoryCAS();
+/// \returns true if \c LLVM_ENABLE_ONDISK_CAS configuration was enabled.
+bool isOnDiskCASEnabled();
+
+/// Create a persistent on-disk path at \p Path.
+Expected<std::unique_ptr<ObjectStore>> createOnDiskCAS(const Twine &Path);
+
} // namespace cas
} // namespace llvm
diff --git a/llvm/include/llvm/CAS/OnDiskGraphDB.h b/llvm/include/llvm/CAS/OnDiskGraphDB.h
index 5f0ee0e..76cc528 100644
--- a/llvm/include/llvm/CAS/OnDiskGraphDB.h
+++ b/llvm/include/llvm/CAS/OnDiskGraphDB.h
@@ -340,13 +340,16 @@ public:
/// \param HashByteSize Size for the object digest hash bytes.
/// \param UpstreamDB Optional on-disk store to be used for faulting-in nodes
/// if they don't exist in the primary store. The upstream store is only used
- /// for reading nodes, new nodes are only written to the primary store.
+ /// for reading nodes, new nodes are only written to the primary store. User
+ /// need to make sure \p UpstreamDB outlives current instance of
+ /// OnDiskGraphDB and the common usage is to have an \p UnifiedOnDiskCache to
+ /// manage both.
/// \param Policy If \p UpstreamDB is provided, controls how nodes are copied
/// to primary store. This is recorded at creation time and subsequent opens
/// need to pass the same policy otherwise the \p open will fail.
static Expected<std::unique_ptr<OnDiskGraphDB>>
open(StringRef Path, StringRef HashName, unsigned HashByteSize,
- std::unique_ptr<OnDiskGraphDB> UpstreamDB = nullptr,
+ OnDiskGraphDB *UpstreamDB = nullptr,
FaultInPolicy Policy = FaultInPolicy::FullTree);
~OnDiskGraphDB();
@@ -438,8 +441,7 @@ private:
// Private constructor.
OnDiskGraphDB(StringRef RootPath, OnDiskTrieRawHashMap Index,
- OnDiskDataAllocator DataPool,
- std::unique_ptr<OnDiskGraphDB> UpstreamDB,
+ OnDiskDataAllocator DataPool, OnDiskGraphDB *UpstreamDB,
FaultInPolicy Policy);
/// Mapping from hash to object reference.
@@ -459,7 +461,7 @@ private:
std::string RootPath;
/// Optional on-disk store to be used for faulting-in nodes.
- std::unique_ptr<OnDiskGraphDB> UpstreamDB;
+ OnDiskGraphDB *UpstreamDB = nullptr;
/// The policy used to fault in data from upstream.
FaultInPolicy FIPolicy;
diff --git a/llvm/include/llvm/CAS/OnDiskKeyValueDB.h b/llvm/include/llvm/CAS/OnDiskKeyValueDB.h
index b762518..17ae52f 100644
--- a/llvm/include/llvm/CAS/OnDiskKeyValueDB.h
+++ b/llvm/include/llvm/CAS/OnDiskKeyValueDB.h
@@ -19,6 +19,8 @@
namespace llvm::cas::ondisk {
+class UnifiedOnDiskCache;
+
/// An on-disk key-value data store with the following properties:
/// * Keys are fixed length binary hashes with expected normal distribution.
/// * Values are buffers of the same size, specified at creation time.
@@ -59,9 +61,13 @@ public:
/// \param KeySize Size for the key hash bytes.
/// \param ValueName Identifier name for the values.
/// \param ValueSize Size for the value bytes.
+ /// \param UnifiedCache An optional UnifiedOnDiskCache that manages the size
+ /// and lifetime of the CAS instance and it must owns current initializing
+ /// KeyValueDB after initialized.
static Expected<std::unique_ptr<OnDiskKeyValueDB>>
open(StringRef Path, StringRef HashName, unsigned KeySize,
- StringRef ValueName, size_t ValueSize);
+ StringRef ValueName, size_t ValueSize,
+ UnifiedOnDiskCache *UnifiedCache = nullptr);
using CheckValueT =
function_ref<Error(FileOffset Offset, ArrayRef<char> Data)>;
@@ -70,11 +76,14 @@ public:
Error validate(CheckValueT CheckValue) const;
private:
- OnDiskKeyValueDB(size_t ValueSize, OnDiskTrieRawHashMap Cache)
- : ValueSize(ValueSize), Cache(std::move(Cache)) {}
+ OnDiskKeyValueDB(size_t ValueSize, OnDiskTrieRawHashMap Cache,
+ UnifiedOnDiskCache *UnifiedCache)
+ : ValueSize(ValueSize), Cache(std::move(Cache)),
+ UnifiedCache(UnifiedCache) {}
const size_t ValueSize;
OnDiskTrieRawHashMap Cache;
+ UnifiedOnDiskCache *UnifiedCache = nullptr;
};
} // namespace llvm::cas::ondisk
diff --git a/llvm/include/llvm/CAS/UnifiedOnDiskCache.h b/llvm/include/llvm/CAS/UnifiedOnDiskCache.h
new file mode 100644
index 0000000..6e0878a
--- /dev/null
+++ b/llvm/include/llvm/CAS/UnifiedOnDiskCache.h
@@ -0,0 +1,172 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_CAS_UNIFIEDONDISKCACHE_H
+#define LLVM_CAS_UNIFIEDONDISKCACHE_H
+
+#include "llvm/CAS/BuiltinUnifiedCASDatabases.h"
+#include "llvm/CAS/OnDiskGraphDB.h"
+#include <atomic>
+
+namespace llvm::cas::ondisk {
+
+class OnDiskKeyValueDB;
+
+/// A unified CAS nodes and key-value database, using on-disk storage for both.
+/// It manages storage growth and provides APIs for garbage collection.
+///
+/// High-level properties:
+/// * While \p UnifiedOnDiskCache is open on a directory, by any process, the
+/// storage size in that directory will keep growing unrestricted. For data to
+/// become eligible for garbage-collection there should be no open instances
+/// of \p UnifiedOnDiskCache for that directory, by any process.
+/// * Garbage-collection needs to be triggered explicitly by the client. It can
+/// be triggered on a directory concurrently, at any time and by any process,
+/// without affecting any active readers/writers, in the same process or other
+/// processes.
+///
+/// Usage patterns should be that an instance of \p UnifiedOnDiskCache is open
+/// for a limited period of time, e.g. for the duration of a build operation.
+/// For long-living processes that need periodic access to a
+/// \p UnifiedOnDiskCache, the client should devise a scheme where access is
+/// performed within some defined period. For example, if a service is designed
+/// to continuously wait for requests that access a \p UnifiedOnDiskCache, it
+/// could keep the instance alive while new requests are coming in but close it
+/// after a time period in which there are no new requests.
+class UnifiedOnDiskCache {
+public:
+ /// The \p OnDiskGraphDB instance for the open directory.
+ OnDiskGraphDB &getGraphDB() { return *PrimaryGraphDB; }
+
+ /// The \p OnDiskGraphDB instance for the open directory.
+ OnDiskKeyValueDB &getKeyValueDB() { return *PrimaryKVDB; }
+
+ /// Open a \p UnifiedOnDiskCache instance for a directory.
+ ///
+ /// \param Path directory for the on-disk database. The directory will be
+ /// created if it doesn't exist.
+ /// \param SizeLimit Optional size for limiting growth. This has an effect for
+ /// when the instance is closed.
+ /// \param HashName Identifier name for the hashing algorithm that is going to
+ /// be used.
+ /// \param HashByteSize Size for the object digest hash bytes.
+ /// \param FaultInPolicy Controls how nodes are copied to primary store. This
+ /// is recorded at creation time and subsequent opens need to pass the same
+ /// policy otherwise the \p open will fail.
+ static Expected<std::unique_ptr<UnifiedOnDiskCache>>
+ open(StringRef Path, std::optional<uint64_t> SizeLimit, StringRef HashName,
+ unsigned HashByteSize,
+ OnDiskGraphDB::FaultInPolicy FaultInPolicy =
+ OnDiskGraphDB::FaultInPolicy::FullTree);
+
+ /// Validate the data in \p Path, if needed to ensure correctness.
+ ///
+ /// Note: if invalid data is detected and \p AllowRecovery is true, then
+ /// recovery requires exclusive access to the CAS and it is an error to
+ /// attempt recovery if there is concurrent use of the CAS.
+ ///
+ /// \param Path directory for the on-disk database.
+ /// \param HashName Identifier name for the hashing algorithm that is going to
+ /// be used.
+ /// \param HashByteSize Size for the object digest hash bytes.
+ /// \param CheckHash Whether to validate hashes match the data.
+ /// \param AllowRecovery Whether to automatically recover from invalid data by
+ /// marking the files for garbage collection.
+ /// \param ForceValidation Whether to force validation to occur even if it
+ /// should not be necessary.
+ /// \param LLVMCasBinary If provided, validation is performed out-of-process
+ /// using the given \c llvm-cas executable which protects against crashes
+ /// during validation. Otherwise validation is performed in-process.
+ ///
+ /// \returns \c Valid if the data is already valid, \c Recovered if data
+ /// was invalid but has been cleared, \c Skipped if validation is not needed,
+ /// or an \c Error if validation cannot be performed or if the data is left
+ /// in an invalid state because \p AllowRecovery is false.
+ static Expected<ValidationResult>
+ validateIfNeeded(StringRef Path, StringRef HashName, unsigned HashByteSize,
+ bool CheckHash, bool AllowRecovery, bool ForceValidation,
+ std::optional<StringRef> LLVMCasBinary);
+
+ /// This is called implicitly at destruction time, so it is not required for a
+ /// client to call this. After calling \p close the only method that is valid
+ /// to call is \p needsGarbageCollection.
+ ///
+ /// \param CheckSizeLimit if true it will check whether the primary store has
+ /// exceeded its intended size limit. If false the check is skipped even if a
+ /// \p SizeLimit was passed to the \p open call.
+ Error close(bool CheckSizeLimit = true);
+
+ /// Set the size for limiting growth. This has an effect for when the instance
+ /// is closed.
+ void setSizeLimit(std::optional<uint64_t> SizeLimit);
+
+ /// \returns the storage size of the cache data.
+ uint64_t getStorageSize() const;
+
+ /// \returns whether the primary store has exceeded the intended size limit.
+ /// This can return false even if the overall size of the opened directory is
+ /// over the \p SizeLimit passed to \p open. To know whether garbage
+ /// collection needs to be triggered or not, call \p needsGarbaseCollection.
+ bool hasExceededSizeLimit() const;
+
+ /// \returns whether there are unused data that can be deleted using a
+ /// \p collectGarbage call.
+ bool needsGarbageCollection() const { return NeedsGarbageCollection; }
+
+ /// Remove any unused data from the directory at \p Path. If there are no such
+ /// data the operation is a no-op.
+ ///
+ /// This can be called concurrently, regardless of whether there is an open
+ /// \p UnifiedOnDiskCache instance or not; it has no effect on readers/writers
+ /// in the same process or other processes.
+ ///
+ /// It is recommended that garbage-collection is triggered concurrently in the
+ /// background, so that it has minimal effect on the workload of the process.
+ static Error collectGarbage(StringRef Path);
+
+ /// Remove unused data from the current UnifiedOnDiskCache.
+ Error collectGarbage();
+
+ /// Helper function to convert the value stored in KeyValueDB and ObjectID.
+ static ObjectID getObjectIDFromValue(ArrayRef<char> Value);
+
+ using ValueBytes = std::array<char, sizeof(uint64_t)>;
+ static ValueBytes getValueFromObjectID(ObjectID ID);
+
+ ~UnifiedOnDiskCache();
+
+private:
+ friend class OnDiskGraphDB;
+ friend class OnDiskKeyValueDB;
+
+ UnifiedOnDiskCache();
+
+ Expected<std::optional<ArrayRef<char>>>
+ faultInFromUpstreamKV(ArrayRef<uint8_t> Key);
+
+ /// \returns the storage size of the primary directory.
+ uint64_t getPrimaryStorageSize() const;
+
+ std::string RootPath;
+ std::atomic<uint64_t> SizeLimit;
+
+ int LockFD = -1;
+
+ std::atomic<bool> NeedsGarbageCollection;
+ std::string PrimaryDBDir;
+
+ std::unique_ptr<OnDiskGraphDB> UpstreamGraphDB;
+ std::unique_ptr<OnDiskGraphDB> PrimaryGraphDB;
+
+ std::unique_ptr<OnDiskKeyValueDB> UpstreamKVDB;
+ std::unique_ptr<OnDiskKeyValueDB> PrimaryKVDB;
+};
+
+} // namespace llvm::cas::ondisk
+
+#endif // LLVM_CAS_UNIFIEDONDISKCACHE_H
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index e8dbc96..221d8f1 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -302,7 +302,6 @@ private:
/// (e.g. scalarization).
std::optional<InstructionCost> getMultipleResultIntrinsicVectorLibCallCost(
const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind,
- RTLIB::Libcall LC,
std::optional<unsigned> CallRetElementIndex = {}) const {
Type *RetTy = ICA.getReturnType();
// Vector variants of the intrinsic can be mapped to a vector library call.
@@ -311,12 +310,38 @@ private:
!isVectorizedStructTy(cast<StructType>(RetTy)))
return std::nullopt;
+ Type *Ty = getContainedTypes(RetTy).front();
+ EVT VT = getTLI()->getValueType(DL, Ty);
+
+ EVT ScalarVT = VT.getScalarType();
+ RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
+
+ switch (ICA.getID()) {
+ case Intrinsic::modf:
+ LC = RTLIB::getMODF(ScalarVT);
+ break;
+ case Intrinsic::sincospi:
+ LC = RTLIB::getSINCOSPI(ScalarVT);
+ break;
+ case Intrinsic::sincos:
+ LC = RTLIB::getSINCOS(ScalarVT);
+ break;
+ default:
+ return std::nullopt;
+ }
+
// Find associated libcall.
- const char *LCName = getTLI()->getLibcallName(LC);
- if (!LCName)
+ RTLIB::LibcallImpl LibcallImpl = getTLI()->getLibcallImpl(LC);
+ if (LibcallImpl == RTLIB::Unsupported)
return std::nullopt;
+ StringRef LCName =
+ RTLIB::RuntimeLibcallsInfo::getLibcallImplName(LibcallImpl);
+
// Search for a corresponding vector variant.
+ //
+ // FIXME: Should use RuntimeLibcallsInfo, not TargetLibraryInfo to get the
+ // vector mapping.
LLVMContext &Ctx = RetTy->getContext();
ElementCount VF = getVectorizedTypeVF(RetTy);
VecDesc const *VD = nullptr;
@@ -2137,22 +2162,6 @@ public:
case Intrinsic::modf:
case Intrinsic::sincos:
case Intrinsic::sincospi: {
- Type *Ty = getContainedTypes(RetTy).front();
- EVT VT = getTLI()->getValueType(DL, Ty);
-
- RTLIB::Libcall LC = [&] {
- switch (ICA.getID()) {
- case Intrinsic::modf:
- return RTLIB::getMODF;
- case Intrinsic::sincos:
- return RTLIB::getSINCOS;
- case Intrinsic::sincospi:
- return RTLIB::getSINCOSPI;
- default:
- llvm_unreachable("unexpected intrinsic");
- }
- }()(VT.getScalarType());
-
std::optional<unsigned> CallRetElementIndex;
// The first element of the modf result is returned by value in the
// libcall.
@@ -2160,7 +2169,7 @@ public:
CallRetElementIndex = 0;
if (auto Cost = getMultipleResultIntrinsicVectorLibCallCost(
- ICA, CostKind, LC, CallRetElementIndex))
+ ICA, CostKind, CallRetElementIndex))
return *Cost;
// Otherwise, fallback to default scalarization cost.
break;
diff --git a/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h b/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h
index caea5b6..54ea68a 100644
--- a/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h
+++ b/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h
@@ -58,7 +58,7 @@ public:
/// The suffix used to identify the merged function that parameterizes
/// the constant values. Note that the original function, without this suffix,
/// becomes a thunk supplying contexts to the merged function via parameters.
- static constexpr const char MergingInstanceSuffix[] = ".Tgm";
+ static constexpr char MergingInstanceSuffix[] = ".Tgm";
GlobalMergeFunc(const ModuleSummaryIndex *Index) : Index(Index) {};
diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h
index 1a5ffb3..0dd4f23c 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAG.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAG.h
@@ -1260,9 +1260,15 @@ public:
/// stack arguments from being clobbered.
LLVM_ABI SDValue getStackArgumentTokenFactor(SDValue Chain);
- std::pair<SDValue, SDValue> getMemcmp(SDValue Chain, const SDLoc &dl,
- SDValue Dst, SDValue Src, SDValue Size,
- const CallInst *CI);
+ /// Lower a memcmp operation into a target library call and return the
+ /// resulting chain and call result as SelectionDAG SDValues.
+ LLVM_ABI std::pair<SDValue, SDValue> getMemcmp(SDValue Chain, const SDLoc &dl,
+ SDValue Dst, SDValue Src,
+ SDValue Size,
+ const CallInst *CI);
+
+ /// Lower a strlen operation into a target library call and return the
+ /// resulting chain and call result as SelectionDAG SDValues.
LLVM_ABI std::pair<SDValue, SDValue>
getStrlen(SDValue Chain, const SDLoc &dl, SDValue Src, const CallInst *CI);
diff --git a/llvm/include/llvm/DebugInfo/DIContext.h b/llvm/include/llvm/DebugInfo/DIContext.h
index e7e87bb..b404c92 100644
--- a/llvm/include/llvm/DebugInfo/DIContext.h
+++ b/llvm/include/llvm/DebugInfo/DIContext.h
@@ -211,6 +211,8 @@ struct DIDumpOptions {
bool ShowAggregateErrors = false;
bool PrintRegisterOnly = false;
std::string JsonErrSummaryFile;
+ /// List of DWARF tags to filter children by.
+ llvm::SmallVector<unsigned, 0> FilterChildTag;
std::function<llvm::StringRef(uint64_t DwarfRegNum, bool IsEH)>
GetNameForDWARFReg;
diff --git a/llvm/include/llvm/Demangle/Utility.h b/llvm/include/llvm/Demangle/Utility.h
index 002a1f5..6e6203d 100644
--- a/llvm/include/llvm/Demangle/Utility.h
+++ b/llvm/include/llvm/Demangle/Utility.h
@@ -81,7 +81,7 @@ public:
OutputBuffer(const OutputBuffer &) = delete;
OutputBuffer &operator=(const OutputBuffer &) = delete;
- virtual ~OutputBuffer() {}
+ virtual ~OutputBuffer() = default;
operator std::string_view() const {
return std::string_view(Buffer, CurrentPosition);
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/aarch32.h b/llvm/include/llvm/ExecutionEngine/JITLink/aarch32.h
index 98170f6..9479c10 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/aarch32.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/aarch32.h
@@ -175,7 +175,7 @@ struct HalfWords {
/// FixupInfo base class is required for dynamic lookups.
struct FixupInfoBase {
LLVM_ABI static const FixupInfoBase *getDynFixupInfo(Edge::Kind K);
- virtual ~FixupInfoBase() {}
+ virtual ~FixupInfoBase() = default;
};
/// FixupInfo checks for Arm edge kinds work on 32-bit words
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/MachOBuilder.h b/llvm/include/llvm/ExecutionEngine/Orc/MachOBuilder.h
index dd41025..1296e24 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/MachOBuilder.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/MachOBuilder.h
@@ -36,7 +36,7 @@ size_t writeMachOStruct(MutableArrayRef<char> Buf, size_t Offset, MachOStruct S,
/// Base type for MachOBuilder load command wrappers.
struct MachOBuilderLoadCommandBase {
- virtual ~MachOBuilderLoadCommandBase() {}
+ virtual ~MachOBuilderLoadCommandBase() = default;
virtual size_t size() const = 0;
virtual size_t write(MutableArrayRef<char> Buf, size_t Offset,
bool SwapStruct) = 0;
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h
index 2c385de..8f87650 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h
@@ -29,7 +29,7 @@ namespace rt_bootstrap {
class LLVM_ABI ExecutorSharedMemoryMapperService final
: public ExecutorBootstrapService {
public:
- ~ExecutorSharedMemoryMapperService() override {};
+ ~ExecutorSharedMemoryMapperService() override = default;
Expected<std::pair<ExecutorAddr, std::string>> reserve(uint64_t Size);
Expected<ExecutorAddr> initialize(ExecutorAddr Reservation,
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index 5331cb5..b3d7ab4 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -2383,7 +2383,7 @@ public:
/// runtime library for debugging
Value *MapNamesArray = nullptr;
- explicit TargetDataRTArgs() {}
+ explicit TargetDataRTArgs() = default;
explicit TargetDataRTArgs(Value *BasePointersArray, Value *PointersArray,
Value *SizesArray, Value *MapTypesArray,
Value *MapTypesArrayEnd, Value *MappersArray,
@@ -2451,7 +2451,7 @@ public:
bool HasNoWait = false;
// Constructors for TargetKernelArgs.
- TargetKernelArgs() {}
+ TargetKernelArgs() = default;
TargetKernelArgs(unsigned NumTargetItems, TargetDataRTArgs RTArgs,
Value *NumIterations, ArrayRef<Value *> NumTeams,
ArrayRef<Value *> NumThreads, Value *DynCGGroupMem,
@@ -2494,7 +2494,7 @@ public:
/// Whether the `target ... data` directive has a `nowait` clause.
bool HasNoWait = false;
- explicit TargetDataInfo() {}
+ explicit TargetDataInfo() = default;
explicit TargetDataInfo(bool RequiresDevicePointerInfo,
bool SeparateBeginEndCalls)
: RequiresDevicePointerInfo(RequiresDevicePointerInfo),
diff --git a/llvm/include/llvm/IR/Attributes.td b/llvm/include/llvm/IR/Attributes.td
index 8ce2b1b..c086a39 100644
--- a/llvm/include/llvm/IR/Attributes.td
+++ b/llvm/include/llvm/IR/Attributes.td
@@ -183,6 +183,11 @@ def NoCallback : EnumAttr<"nocallback", IntersectAnd, [FnAttr]>;
/// Specify how the pointer may be captured.
def Captures : IntAttr<"captures", IntersectCustom, [ParamAttr]>;
+/// Result will not be undef or poison if all arguments are not undef and not
+/// poison.
+def NoCreateUndefOrPoison
+ : EnumAttr<"nocreateundeforpoison", IntersectAnd, [FnAttr]>;
+
/// Function is not a source of divergence.
def NoDivergenceSource : EnumAttr<"nodivergencesource", IntersectAnd, [FnAttr]>;
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index 457c60e3b..66f44fe 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -589,7 +589,7 @@ filterDbgVars(iterator_range<simple_ilist<DbgRecord>::iterator> R) {
/// date.
class DbgMarker {
public:
- DbgMarker() {}
+ DbgMarker() = default;
/// Link back to the Instruction that owns this marker. Can be null during
/// operations that move a marker from one instruction to another.
Instruction *MarkedInstr = nullptr;
diff --git a/llvm/include/llvm/IR/DroppedVariableStats.h b/llvm/include/llvm/IR/DroppedVariableStats.h
index 42e86dd..8a1dbd6a 100644
--- a/llvm/include/llvm/IR/DroppedVariableStats.h
+++ b/llvm/include/llvm/IR/DroppedVariableStats.h
@@ -42,7 +42,7 @@ class DroppedVariableStats {
public:
LLVM_ABI DroppedVariableStats(bool DroppedVarStatsEnabled);
- virtual ~DroppedVariableStats() {}
+ virtual ~DroppedVariableStats() = default;
// We intend this to be unique per-compilation, thus no copies.
DroppedVariableStats(const DroppedVariableStats &) = delete;
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 27930bb..8bd060a 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -3556,6 +3556,11 @@ public:
/// correspondent branch weight.
LLVM_ABI SwitchInst::CaseIt removeCase(SwitchInst::CaseIt I);
+ /// Replace the default destination by given case. Delegate the call to
+ /// the underlying SwitchInst::setDefaultDest and remove correspondent branch
+ /// weight.
+ LLVM_ABI void replaceDefaultDest(SwitchInst::CaseIt I);
+
/// Delegate the call to the underlying SwitchInst::addCase() and set the
/// specified branch weight for the added case.
LLVM_ABI void addCase(ConstantInt *OnVal, BasicBlock *Dest, CaseWeightOpt W);
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 4d59ee8..6a079f6 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -186,6 +186,10 @@ def IntrSpeculatable : IntrinsicProperty;
// defined by the hasSideEffects property of the TableGen Instruction class.
def IntrHasSideEffects : IntrinsicProperty;
+// Result will not be undef or poison if all arguments are not undef and not
+// poison.
+def IntrNoCreateUndefOrPoison : IntrinsicProperty;
+
//===----------------------------------------------------------------------===//
// IIT constants and utils
//===----------------------------------------------------------------------===//
@@ -1039,7 +1043,7 @@ def int_experimental_memset_pattern
// FIXME: Add version of these floating point intrinsics which allow non-default
// rounding modes and FP exception handling.
-let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
+let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison] in {
def int_fma : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
[LLVMMatchType<0>, LLVMMatchType<0>,
LLVMMatchType<0>]>;
@@ -1052,16 +1056,8 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
// environment so they can be treated as readnone.
def int_sqrt : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
def int_powi : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, llvm_anyint_ty]>;
- def int_asin : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
- def int_acos : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
- def int_atan : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
- def int_atan2 : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>]>;
def int_sin : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
def int_cos : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
- def int_tan : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
- def int_sinh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
- def int_cosh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
- def int_tanh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
def int_pow : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
[LLVMMatchType<0>, LLVMMatchType<0>]>;
def int_log : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
@@ -1080,12 +1076,6 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
def int_nearbyint : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
def int_round : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
def int_roundeven : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
- def int_sincos : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
- [llvm_anyfloat_ty]>;
- def int_sincospi : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
- [llvm_anyfloat_ty]>;
- def int_modf : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
- [llvm_anyfloat_ty]>;
// Truncate a floating point number with a specific rounding mode
def int_fptrunc_round : DefaultAttrsIntrinsic<[ llvm_anyfloat_ty ],
@@ -1097,6 +1087,8 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
def int_arithmetic_fence : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>],
[IntrNoMem]>;
+ // If the value doesn't fit an unspecified value is returned, but this
+ // is not poison so we can still mark these as IntrNoCreateUndefOrPoison.
def int_lround : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
def int_llround : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
def int_lrint : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
@@ -1110,29 +1102,50 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
def int_frexp : DefaultAttrsIntrinsic<[llvm_anyfloat_ty, llvm_anyint_ty], [LLVMMatchType<0>]>;
}
+// TODO: Move all of these into the IntrNoCreateUndefOrPoison case above.
+let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
+ // These functions do not read memory, but are sensitive to the
+ // rounding mode. LLVM purposely does not model changes to the FP
+ // environment so they can be treated as readnone.
+ def int_asin : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
+ def int_acos : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
+ def int_atan : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
+ def int_atan2 : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>]>;
+ def int_tan : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
+ def int_sinh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
+ def int_cosh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
+ def int_tanh : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
+ def int_sincos : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
+ [llvm_anyfloat_ty]>;
+ def int_sincospi : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
+ [llvm_anyfloat_ty]>;
+ def int_modf : DefaultAttrsIntrinsic<[LLVMMatchType<0>, LLVMMatchType<0>],
+ [llvm_anyfloat_ty]>;
+}
+
def int_minnum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable, Commutative]
+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison]
>;
def int_maxnum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable, Commutative]
+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison]
>;
def int_minimum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable, Commutative]
+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison]
>;
def int_maximum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable, Commutative]
+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison]
>;
def int_minimumnum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable, Commutative]
+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison]
>;
def int_maximumnum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable, Commutative]
+ [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison]
>;
// Internal interface for object size checking
@@ -1164,7 +1177,7 @@ let IntrProperties = [IntrInaccessibleMemOnly] in {
def int_is_fpclass
: DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
[llvm_anyfloat_ty, llvm_i32_ty],
- [IntrNoMem, IntrSpeculatable, ImmArg<ArgIndex<1>>]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison, ImmArg<ArgIndex<1>>]>;
//===--------------- Constrained Floating Point Intrinsics ----------------===//
//
@@ -1406,7 +1419,7 @@ def int_expect_with_probability : DefaultAttrsIntrinsic<[llvm_anyint_ty],
//
// None of these intrinsics accesses memory at all.
-let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
+let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison] in {
def int_bswap: DefaultAttrsIntrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
def int_ctpop: DefaultAttrsIntrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
def int_bitreverse : DefaultAttrsIntrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
@@ -1521,7 +1534,7 @@ def int_adjust_trampoline : DefaultAttrsIntrinsic<
//
// Expose the carry flag from add operations on two integrals.
-let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
+let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison] in {
def int_sadd_with_overflow : DefaultAttrsIntrinsic<[llvm_anyint_ty,
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
[LLVMMatchType<0>, LLVMMatchType<0>]>;
@@ -1547,16 +1560,16 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
//
def int_sadd_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable, Commutative]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison, Commutative]>;
def int_uadd_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable, Commutative]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison, Commutative]>;
def int_ssub_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison]>;
def int_usub_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison]>;
def int_sshl_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty],
[LLVMMatchType<0>, LLVMMatchType<0>],
[IntrNoMem, IntrSpeculatable]>;
@@ -1611,22 +1624,22 @@ def int_abs : DefaultAttrsIntrinsic<
def int_smax : DefaultAttrsIntrinsic<
[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison]>;
def int_smin : DefaultAttrsIntrinsic<
[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison]>;
def int_umax : DefaultAttrsIntrinsic<
[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison]>;
def int_umin : DefaultAttrsIntrinsic<
[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>],
- [IntrNoMem, IntrSpeculatable]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison]>;
def int_scmp : DefaultAttrsIntrinsic<
[llvm_anyint_ty], [llvm_anyint_ty, LLVMMatchType<1>],
- [IntrNoMem, IntrSpeculatable, Range<RetIndex, -1, 2>]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison, Range<RetIndex, -1, 2>]>;
def int_ucmp : DefaultAttrsIntrinsic<
[llvm_anyint_ty], [llvm_anyint_ty, LLVMMatchType<1>],
- [IntrNoMem, IntrSpeculatable, Range<RetIndex, -1, 2>]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison, Range<RetIndex, -1, 2>]>;
//===------------------------- Memory Use Markers -------------------------===//
//
@@ -1868,7 +1881,7 @@ def int_convert_from_fp16 : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [llvm_i16_
}
// Saturating floating point to integer intrinsics
-let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
+let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison] in {
def int_fptoui_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
def int_fptosi_sat : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
}
@@ -1890,7 +1903,7 @@ def int_fake_use : DefaultAttrsIntrinsic<[], [llvm_vararg_ty],
// First argument must be pointer or vector of pointer. This is checked by the
// verifier.
def int_ptrmask: DefaultAttrsIntrinsic<[llvm_any_ty], [LLVMMatchType<0>, llvm_anyint_ty],
- [IntrNoMem, IntrSpeculatable]>;
+ [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison]>;
// Intrinsic to wrap a thread local variable.
def int_threadlocal_address : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [LLVMMatchType<0>],
diff --git a/llvm/include/llvm/IR/IntrinsicsDirectX.td b/llvm/include/llvm/IR/IntrinsicsDirectX.td
index d6b8563..9924b90 100644
--- a/llvm/include/llvm/IR/IntrinsicsDirectX.td
+++ b/llvm/include/llvm/IR/IntrinsicsDirectX.td
@@ -140,6 +140,9 @@ def int_dx_isinf : DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1
def int_dx_isnan : DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
[llvm_anyfloat_ty], [IntrNoMem]>;
+def int_dx_legacyf16tof32 : DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_float_ty>],
+ [llvm_anyint_ty], [IntrNoMem]>;
+
def int_dx_lerp : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty, LLVMMatchType<0>,LLVMMatchType<0>],
[IntrNoMem]>;
diff --git a/llvm/include/llvm/IR/IntrinsicsSPIRV.td b/llvm/include/llvm/IR/IntrinsicsSPIRV.td
index bc51fb6..f39c6cd 100644
--- a/llvm/include/llvm/IR/IntrinsicsSPIRV.td
+++ b/llvm/include/llvm/IR/IntrinsicsSPIRV.td
@@ -200,4 +200,7 @@ def int_spv_resource_nonuniformindex
def int_spv_generic_cast_to_ptr_explicit
: DefaultAttrsIntrinsic<[llvm_anyptr_ty], [generic_ptr_ty],
[IntrNoMem, NoUndef<RetIndex>]>;
+
+ def int_spv_unpackhalf2x16 : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [llvm_i32_ty], [IntrNoMem]>;
+
}
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 0135989..ab14ed4 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -186,6 +186,13 @@ public:
return RTLIB::Unsupported;
}
+ /// \returns the function type and attributes for the \p LibcallImpl,
+ /// depending on the target \p TT. If the function has incomplete type
+ /// information, return nullptr for the function type.
+ std::pair<FunctionType *, AttributeList>
+ getFunctionTy(LLVMContext &Ctx, const Triple &TT, const DataLayout &DL,
+ RTLIB::LibcallImpl LibcallImpl) const;
+
private:
LLVM_ABI static iota_range<RTLIB::LibcallImpl>
lookupLibcallImplNameImpl(StringRef Name);
diff --git a/llvm/include/llvm/IR/TrackingMDRef.h b/llvm/include/llvm/IR/TrackingMDRef.h
index d737739..7ad7225 100644
--- a/llvm/include/llvm/IR/TrackingMDRef.h
+++ b/llvm/include/llvm/IR/TrackingMDRef.h
@@ -111,17 +111,14 @@ public:
explicit TypedTrackingMDRef(T *MD) : Ref(static_cast<Metadata *>(MD)) {}
TypedTrackingMDRef(TypedTrackingMDRef &&X) : Ref(std::move(X.Ref)) {}
- TypedTrackingMDRef(const TypedTrackingMDRef &X) : Ref(X.Ref) {}
+ TypedTrackingMDRef(const TypedTrackingMDRef &X) = default;
TypedTrackingMDRef &operator=(TypedTrackingMDRef &&X) {
Ref = std::move(X.Ref);
return *this;
}
- TypedTrackingMDRef &operator=(const TypedTrackingMDRef &X) {
- Ref = X.Ref;
- return *this;
- }
+ TypedTrackingMDRef &operator=(const TypedTrackingMDRef &X) = default;
T *get() const { return (T *)Ref.get(); }
operator T *() const { return get(); }
diff --git a/llvm/include/llvm/MC/MCRegisterInfo.h b/llvm/include/llvm/MC/MCRegisterInfo.h
index e6fc707..f611edd 100644
--- a/llvm/include/llvm/MC/MCRegisterInfo.h
+++ b/llvm/include/llvm/MC/MCRegisterInfo.h
@@ -272,7 +272,7 @@ public:
friend class MCRegUnitRootIterator;
friend class MCRegAliasIterator;
- virtual ~MCRegisterInfo() {}
+ virtual ~MCRegisterInfo() = default;
/// Initialize MCRegisterInfo, called by TableGen
/// auto-generated routines. *DO NOT USE*.
diff --git a/llvm/include/llvm/MCA/SourceMgr.h b/llvm/include/llvm/MCA/SourceMgr.h
index 16a60d1..300961c 100644
--- a/llvm/include/llvm/MCA/SourceMgr.h
+++ b/llvm/include/llvm/MCA/SourceMgr.h
@@ -50,7 +50,7 @@ struct SourceMgr {
/// Advance to the next \a SourceRef.
virtual void updateNext() = 0;
- virtual ~SourceMgr() {}
+ virtual ~SourceMgr() = default;
};
/// The default implementation of \a SourceMgr. It always takes a fixed number
diff --git a/llvm/include/llvm/ObjCopy/ConfigManager.h b/llvm/include/llvm/ObjCopy/ConfigManager.h
index 1568799..45f847f 100644
--- a/llvm/include/llvm/ObjCopy/ConfigManager.h
+++ b/llvm/include/llvm/ObjCopy/ConfigManager.h
@@ -23,7 +23,7 @@ namespace llvm {
namespace objcopy {
struct LLVM_ABI ConfigManager : public MultiFormatConfig {
- ~ConfigManager() override {}
+ ~ConfigManager() override = default;
const CommonConfig &getCommonConfig() const override { return Common; }
diff --git a/llvm/include/llvm/ObjCopy/MultiFormatConfig.h b/llvm/include/llvm/ObjCopy/MultiFormatConfig.h
index bb93f64..91baf9b 100644
--- a/llvm/include/llvm/ObjCopy/MultiFormatConfig.h
+++ b/llvm/include/llvm/ObjCopy/MultiFormatConfig.h
@@ -24,7 +24,7 @@ struct DXContainerConfig;
class MultiFormatConfig {
public:
- virtual ~MultiFormatConfig() {}
+ virtual ~MultiFormatConfig() = default;
virtual const CommonConfig &getCommonConfig() const = 0;
virtual Expected<const ELFConfig &> getELFConfig() const = 0;
diff --git a/llvm/include/llvm/Object/MachO.h b/llvm/include/llvm/Object/MachO.h
index 01e7c6b..f4c1e30 100644
--- a/llvm/include/llvm/Object/MachO.h
+++ b/llvm/include/llvm/Object/MachO.h
@@ -447,7 +447,7 @@ public:
uint64_t getSectionAddress(DataRefImpl Sec) const override;
uint64_t getSectionIndex(DataRefImpl Sec) const override;
uint64_t getSectionSize(DataRefImpl Sec) const override;
- ArrayRef<uint8_t> getSectionContents(uint32_t Offset, uint64_t Size) const;
+ ArrayRef<uint8_t> getSectionContents(uint64_t Offset, uint64_t Size) const;
Expected<ArrayRef<uint8_t>>
getSectionContents(DataRefImpl Sec) const override;
uint64_t getSectionAlignment(DataRefImpl Sec) const override;
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index b5b110d..fbfe306 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -115,7 +115,7 @@ struct RootParameterHeaderYaml {
dxbc::ShaderVisibility Visibility;
uint32_t Offset;
- RootParameterHeaderYaml(){};
+ RootParameterHeaderYaml() = default;
RootParameterHeaderYaml(dxbc::RootParameterType T) : Type(T) {}
};
@@ -123,7 +123,7 @@ struct RootParameterLocationYaml {
RootParameterHeaderYaml Header;
std::optional<size_t> IndexInSignature;
- RootParameterLocationYaml(){};
+ RootParameterLocationYaml() = default;
explicit RootParameterLocationYaml(RootParameterHeaderYaml Header)
: Header(Header) {}
};
diff --git a/llvm/include/llvm/ProfileData/DataAccessProf.h b/llvm/include/llvm/ProfileData/DataAccessProf.h
index 608306f..ea256ef 100644
--- a/llvm/include/llvm/ProfileData/DataAccessProf.h
+++ b/llvm/include/llvm/ProfileData/DataAccessProf.h
@@ -42,7 +42,7 @@ struct SourceLocation {
: FileName(FileNameRef.str()), Line(Line) {}
// Empty constructor is used in yaml conversion.
- SourceLocation() {}
+ SourceLocation() = default;
/// The filename where the data is located.
std::string FileName;
/// The line number in the source code.
diff --git a/llvm/include/llvm/SandboxIR/Context.h b/llvm/include/llvm/SandboxIR/Context.h
index 7d8b2c8..a8966db 100644
--- a/llvm/include/llvm/SandboxIR/Context.h
+++ b/llvm/include/llvm/SandboxIR/Context.h
@@ -51,7 +51,7 @@ public:
// Uses a 64-bit integer so we don't have to worry about the unlikely case
// of overflowing a 32-bit counter.
using ValTy = uint64_t;
- static constexpr const ValTy InvalidVal = 0;
+ static constexpr ValTy InvalidVal = 0;
private:
// Default initialization results in an invalid ID.
diff --git a/llvm/include/llvm/SandboxIR/Instruction.h b/llvm/include/llvm/SandboxIR/Instruction.h
index e1c1ca0..5e369a4 100644
--- a/llvm/include/llvm/SandboxIR/Instruction.h
+++ b/llvm/include/llvm/SandboxIR/Instruction.h
@@ -1866,7 +1866,7 @@ class SwitchInst : public SingleLLVMInstructionImpl<llvm::SwitchInst> {
friend class Context; // For accessing the constructor in create*()
public:
- static constexpr const unsigned DefaultPseudoIndex =
+ static constexpr unsigned DefaultPseudoIndex =
llvm::SwitchInst::DefaultPseudoIndex;
LLVM_ABI static SwitchInst *create(Value *V, BasicBlock *Dest,
diff --git a/llvm/include/llvm/SandboxIR/Pass.h b/llvm/include/llvm/SandboxIR/Pass.h
index 267389a..eb84f21 100644
--- a/llvm/include/llvm/SandboxIR/Pass.h
+++ b/llvm/include/llvm/SandboxIR/Pass.h
@@ -56,7 +56,7 @@ public:
"A pass name should not contain whitespaces!");
assert(!Name.starts_with('-') && "A pass name should not start with '-'!");
}
- virtual ~Pass() {}
+ virtual ~Pass() = default;
/// \Returns the name of the pass.
StringRef getName() const { return Name; }
#ifndef NDEBUG
diff --git a/llvm/include/llvm/SandboxIR/PassManager.h b/llvm/include/llvm/SandboxIR/PassManager.h
index 93ca710..a8117aa 100644
--- a/llvm/include/llvm/SandboxIR/PassManager.h
+++ b/llvm/include/llvm/SandboxIR/PassManager.h
@@ -59,10 +59,10 @@ public:
Passes.push_back(std::move(Pass));
}
- static constexpr const char EndToken = '\0';
- static constexpr const char BeginArgsToken = '<';
- static constexpr const char EndArgsToken = '>';
- static constexpr const char PassDelimToken = ',';
+ static constexpr char EndToken = '\0';
+ static constexpr char BeginArgsToken = '<';
+ static constexpr char EndArgsToken = '>';
+ static constexpr char PassDelimToken = ',';
/// Parses \p Pipeline as a comma-separated sequence of pass names and sets
/// the pass pipeline, using \p CreatePass to instantiate passes by name.
diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h
index bc02659..fffcbd9 100644
--- a/llvm/include/llvm/Support/Allocator.h
+++ b/llvm/include/llvm/Support/Allocator.h
@@ -380,7 +380,7 @@ private:
/// The standard BumpPtrAllocator which just uses the default template
/// parameters.
-typedef BumpPtrAllocatorImpl<> BumpPtrAllocator;
+using BumpPtrAllocator = BumpPtrAllocatorImpl<>;
/// A BumpPtrAllocator that allows only elements of a specific type to be
/// allocated.
diff --git a/llvm/include/llvm/Support/Atomic.h b/llvm/include/llvm/Support/Atomic.h
index c2d9ae2..3c62672 100644
--- a/llvm/include/llvm/Support/Atomic.h
+++ b/llvm/include/llvm/Support/Atomic.h
@@ -30,9 +30,9 @@ namespace llvm {
LLVM_ABI void MemoryFence();
#ifdef _MSC_VER
- typedef long cas_flag;
+ using cas_flag = long;
#else
- typedef uint32_t cas_flag;
+ using cas_flag = uint32_t;
#endif
LLVM_ABI cas_flag CompareAndSwap(volatile cas_flag *ptr, cas_flag new_value,
cas_flag old_value);
diff --git a/llvm/include/llvm/Support/BinaryStreamArray.h b/llvm/include/llvm/Support/BinaryStreamArray.h
index ef2233c..a7d03f6 100644
--- a/llvm/include/llvm/Support/BinaryStreamArray.h
+++ b/llvm/include/llvm/Support/BinaryStreamArray.h
@@ -93,7 +93,7 @@ class VarStreamArray {
friend class VarStreamArrayIterator<ValueType, Extractor>;
public:
- typedef VarStreamArrayIterator<ValueType, Extractor> Iterator;
+ using Iterator = VarStreamArrayIterator<ValueType, Extractor>;
VarStreamArray() = default;
@@ -156,8 +156,8 @@ template <typename ValueType, typename Extractor>
class VarStreamArrayIterator
: public iterator_facade_base<VarStreamArrayIterator<ValueType, Extractor>,
std::forward_iterator_tag, const ValueType> {
- typedef VarStreamArrayIterator<ValueType, Extractor> IterType;
- typedef VarStreamArray<ValueType, Extractor> ArrayType;
+ using IterType = VarStreamArrayIterator<ValueType, Extractor>;
+ using ArrayType = VarStreamArray<ValueType, Extractor>;
public:
VarStreamArrayIterator(const ArrayType &Array, const Extractor &E,
@@ -260,7 +260,7 @@ template <typename T> class FixedStreamArray {
friend class FixedStreamArrayIterator<T>;
public:
- typedef FixedStreamArrayIterator<T> Iterator;
+ using Iterator = FixedStreamArrayIterator<T>;
FixedStreamArray() = default;
explicit FixedStreamArray(BinaryStreamRef Stream) : Stream(Stream) {
diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h
index 5b8102d..e5f98249 100644
--- a/llvm/include/llvm/Support/Chrono.h
+++ b/llvm/include/llvm/Support/Chrono.h
@@ -150,10 +150,10 @@ template <> struct unit<std::nano> {
template <typename Rep, typename Period>
struct format_provider<std::chrono::duration<Rep, Period>> {
private:
- typedef std::chrono::duration<Rep, Period> Dur;
- typedef std::conditional_t<std::chrono::treat_as_floating_point<Rep>::value,
- double, intmax_t>
- InternalRep;
+ using Dur = std::chrono::duration<Rep, Period>;
+ using InternalRep =
+ std::conditional_t<std::chrono::treat_as_floating_point<Rep>::value,
+ double, intmax_t>;
template <typename AsPeriod> static InternalRep getAs(const Dur &D) {
using namespace std::chrono;
diff --git a/llvm/include/llvm/Support/ConvertUTF.h b/llvm/include/llvm/Support/ConvertUTF.h
index bb17235..ddf7057 100644
--- a/llvm/include/llvm/Support/ConvertUTF.h
+++ b/llvm/include/llvm/Support/ConvertUTF.h
@@ -126,10 +126,10 @@ namespace llvm {
bit mask & shift operations.
------------------------------------------------------------------------ */
-typedef unsigned int UTF32; /* at least 32 bits */
-typedef unsigned short UTF16; /* at least 16 bits */
-typedef unsigned char UTF8; /* typically 8 bits */
-typedef unsigned char Boolean; /* 0 or 1 */
+using UTF32 = unsigned int; /* at least 32 bits */
+using UTF16 = unsigned short; /* at least 16 bits */
+using UTF8 = unsigned char; /* typically 8 bits */
+using Boolean = unsigned char; /* 0 or 1 */
/* Some fundamental constants */
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
@@ -146,17 +146,14 @@ typedef unsigned char Boolean; /* 0 or 1 */
#define UNI_UTF32_BYTE_ORDER_MARK_NATIVE 0x0000FEFF
#define UNI_UTF32_BYTE_ORDER_MARK_SWAPPED 0xFFFE0000
-typedef enum {
- conversionOK, /* conversion successful */
- sourceExhausted, /* partial character in source, but hit end */
- targetExhausted, /* insuff. room in target for conversion */
- sourceIllegal /* source sequence is illegal/malformed */
-} ConversionResult;
-
-typedef enum {
- strictConversion = 0,
- lenientConversion
-} ConversionFlags;
+enum ConversionResult {
+ conversionOK, /* conversion successful */
+ sourceExhausted, /* partial character in source, but hit end */
+ targetExhausted, /* insuff. room in target for conversion */
+ sourceIllegal /* source sequence is illegal/malformed */
+};
+
+enum ConversionFlags { strictConversion = 0, lenientConversion };
LLVM_ABI ConversionResult ConvertUTF8toUTF16(const UTF8 **sourceStart,
const UTF8 *sourceEnd,
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index 39a08d4..9904a0d 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -140,7 +140,7 @@ public:
}
// Iterate through the registered counters
- typedef UniqueVector<std::string> CounterVector;
+ using CounterVector = UniqueVector<std::string>;
CounterVector::const_iterator begin() const {
return RegisteredCounters.begin();
}
diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h
index 4c17b6e8..a4fd008 100644
--- a/llvm/include/llvm/Support/ErrorHandling.h
+++ b/llvm/include/llvm/Support/ErrorHandling.h
@@ -21,8 +21,8 @@ class StringRef;
class Twine;
/// An error handler callback.
-typedef void (*fatal_error_handler_t)(void *user_data, const char *reason,
- bool gen_crash_diag);
+using fatal_error_handler_t = void (*)(void *user_data, const char *reason,
+ bool gen_crash_diag);
/// install_fatal_error_handler - Installs a new error handler to be used
/// whenever a serious (non-recoverable) error is encountered by LLVM.
diff --git a/llvm/include/llvm/Support/FormatVariadicDetails.h b/llvm/include/llvm/Support/FormatVariadicDetails.h
index 0fdc7b6..c0b245e 100644
--- a/llvm/include/llvm/Support/FormatVariadicDetails.h
+++ b/llvm/include/llvm/Support/FormatVariadicDetails.h
@@ -63,8 +63,8 @@ template <typename T> class missing_format_adapter;
template <class T> class has_FormatProvider {
public:
using Decayed = std::decay_t<T>;
- typedef void (*Signature_format)(const Decayed &, llvm::raw_ostream &,
- StringRef);
+ using Signature_format = void (*)(const Decayed &, llvm::raw_ostream &,
+ StringRef);
template <typename U> using check = SameType<Signature_format, &U::format>;
diff --git a/llvm/include/llvm/Support/GenericLoopInfo.h b/llvm/include/llvm/Support/GenericLoopInfo.h
index b6bb360..9e2f61f 100644
--- a/llvm/include/llvm/Support/GenericLoopInfo.h
+++ b/llvm/include/llvm/Support/GenericLoopInfo.h
@@ -150,9 +150,9 @@ public:
assert(!isInvalid() && "Loop not in a valid state!");
return SubLoops;
}
- typedef typename std::vector<LoopT *>::const_iterator iterator;
- typedef
- typename std::vector<LoopT *>::const_reverse_iterator reverse_iterator;
+ using iterator = typename std::vector<LoopT *>::const_iterator;
+ using reverse_iterator =
+ typename std::vector<LoopT *>::const_reverse_iterator;
iterator begin() const { return getSubLoops().begin(); }
iterator end() const { return getSubLoops().end(); }
reverse_iterator rbegin() const { return getSubLoops().rbegin(); }
@@ -174,7 +174,7 @@ public:
assert(!isInvalid() && "Loop not in a valid state!");
return Blocks;
}
- typedef typename ArrayRef<BlockT *>::const_iterator block_iterator;
+ using block_iterator = typename ArrayRef<BlockT *>::const_iterator;
block_iterator block_begin() const { return getBlocks().begin(); }
block_iterator block_end() const { return getBlocks().end(); }
inline iterator_range<block_iterator> blocks() const {
@@ -302,7 +302,7 @@ public:
bool hasNoExitBlocks() const;
/// Edge type.
- typedef std::pair<BlockT *, BlockT *> Edge;
+ using Edge = std::pair<BlockT *, BlockT *>;
/// Return all pairs of (_inside_block_,_outside_block_).
void getExitEdges(SmallVectorImpl<Edge> &ExitEdges) const;
@@ -575,9 +575,9 @@ public:
/// iterator/begin/end - The interface to the top-level loops in the current
/// function.
///
- typedef typename std::vector<LoopT *>::const_iterator iterator;
- typedef
- typename std::vector<LoopT *>::const_reverse_iterator reverse_iterator;
+ using iterator = typename std::vector<LoopT *>::const_iterator;
+ using reverse_iterator =
+ typename std::vector<LoopT *>::const_reverse_iterator;
iterator begin() const { return TopLevelLoops.begin(); }
iterator end() const { return TopLevelLoops.end(); }
reverse_iterator rbegin() const { return TopLevelLoops.rbegin(); }
diff --git a/llvm/include/llvm/Support/GenericLoopInfoImpl.h b/llvm/include/llvm/Support/GenericLoopInfoImpl.h
index 5416780..c830f0a 100644
--- a/llvm/include/llvm/Support/GenericLoopInfoImpl.h
+++ b/llvm/include/llvm/Support/GenericLoopInfoImpl.h
@@ -459,7 +459,7 @@ template <class BlockT, class LoopT>
static void discoverAndMapSubloop(LoopT *L, ArrayRef<BlockT *> Backedges,
LoopInfoBase<BlockT, LoopT> *LI,
const DomTreeBase<BlockT> &DomTree) {
- typedef GraphTraits<Inverse<BlockT *>> InvBlockTraits;
+ using InvBlockTraits = GraphTraits<Inverse<BlockT *>>;
unsigned NumBlocks = 0;
unsigned NumSubloops = 0;
@@ -513,8 +513,8 @@ static void discoverAndMapSubloop(LoopT *L, ArrayRef<BlockT *> Backedges,
/// Populate all loop data in a stable order during a single forward DFS.
template <class BlockT, class LoopT> class PopulateLoopsDFS {
- typedef GraphTraits<BlockT *> BlockTraits;
- typedef typename BlockTraits::ChildIteratorType SuccIterTy;
+ using BlockTraits = GraphTraits<BlockT *>;
+ using SuccIterTy = typename BlockTraits::ChildIteratorType;
LoopInfoBase<BlockT, LoopT> *LI;
diff --git a/llvm/include/llvm/Support/MD5.h b/llvm/include/llvm/Support/MD5.h
index 4ba3867..dbcb66d 100644
--- a/llvm/include/llvm/Support/MD5.h
+++ b/llvm/include/llvm/Support/MD5.h
@@ -90,7 +90,7 @@ public:
private:
// Any 32-bit or wider unsigned integer data type will do.
- typedef uint32_t MD5_u32plus;
+ using MD5_u32plus = uint32_t;
// Internal State
struct {
diff --git a/llvm/include/llvm/Support/Mutex.h b/llvm/include/llvm/Support/Mutex.h
index d61e3fd..3ca5c9a 100644
--- a/llvm/include/llvm/Support/Mutex.h
+++ b/llvm/include/llvm/Support/Mutex.h
@@ -63,12 +63,12 @@ namespace llvm
};
/// Mutex - A standard, always enforced mutex.
- typedef SmartMutex<false> Mutex;
+ using Mutex = SmartMutex<false>;
template <bool mt_only>
using SmartScopedLock = std::lock_guard<SmartMutex<mt_only>>;
- typedef SmartScopedLock<false> ScopedLock;
+ using ScopedLock = SmartScopedLock<false>;
}
}
diff --git a/llvm/include/llvm/Support/OnDiskHashTable.h b/llvm/include/llvm/Support/OnDiskHashTable.h
index d7d72cf..54c6b71 100644
--- a/llvm/include/llvm/Support/OnDiskHashTable.h
+++ b/llvm/include/llvm/Support/OnDiskHashTable.h
@@ -69,7 +69,7 @@ template <typename Info> class OnDiskChainedHashTableGenerator {
: Key(Key), Data(Data), Next(nullptr), Hash(InfoObj.ComputeHash(Key)) {}
};
- typedef typename Info::offset_type offset_type;
+ using offset_type = typename Info::offset_type;
offset_type NumBuckets;
offset_type NumEntries;
llvm::SpecificBumpPtrAllocator<Item> BA;
@@ -278,12 +278,12 @@ template <typename Info> class OnDiskChainedHashTable {
Info InfoObj;
public:
- typedef Info InfoType;
- typedef typename Info::internal_key_type internal_key_type;
- typedef typename Info::external_key_type external_key_type;
- typedef typename Info::data_type data_type;
- typedef typename Info::hash_value_type hash_value_type;
- typedef typename Info::offset_type offset_type;
+ using InfoType = Info;
+ using internal_key_type = typename Info::internal_key_type;
+ using external_key_type = typename Info::external_key_type;
+ using data_type = typename Info::data_type;
+ using hash_value_type = typename Info::hash_value_type;
+ using offset_type = typename Info::offset_type;
OnDiskChainedHashTable(offset_type NumBuckets, offset_type NumEntries,
const unsigned char *Buckets,
@@ -435,12 +435,12 @@ class OnDiskIterableChainedHashTable : public OnDiskChainedHashTable<Info> {
const unsigned char *Payload;
public:
- typedef OnDiskChainedHashTable<Info> base_type;
- typedef typename base_type::internal_key_type internal_key_type;
- typedef typename base_type::external_key_type external_key_type;
- typedef typename base_type::data_type data_type;
- typedef typename base_type::hash_value_type hash_value_type;
- typedef typename base_type::offset_type offset_type;
+ using base_type = OnDiskChainedHashTable<Info>;
+ using internal_key_type = typename base_type::internal_key_type;
+ using external_key_type = typename base_type::external_key_type;
+ using data_type = typename base_type::data_type;
+ using hash_value_type = typename base_type::hash_value_type;
+ using offset_type = typename base_type::offset_type;
private:
/// Iterates over all of the keys in the table.
@@ -450,7 +450,7 @@ private:
offset_type NumEntriesLeft;
public:
- typedef external_key_type value_type;
+ using value_type = external_key_type;
iterator_base(const unsigned char *const Ptr, offset_type NumEntries)
: Ptr(Ptr), NumItemsInBucketLeft(0), NumEntriesLeft(NumEntries) {}
@@ -505,7 +505,7 @@ public:
Info *InfoObj;
public:
- typedef external_key_type value_type;
+ using value_type = external_key_type;
key_iterator(const unsigned char *const Ptr, offset_type NumEntries,
Info *InfoObj)
@@ -551,7 +551,7 @@ public:
Info *InfoObj;
public:
- typedef data_type value_type;
+ using value_type = data_type;
data_iterator(const unsigned char *const Ptr, offset_type NumEntries,
Info *InfoObj)
diff --git a/llvm/include/llvm/Support/PointerLikeTypeTraits.h b/llvm/include/llvm/Support/PointerLikeTypeTraits.h
index 320f6b6..a47d684 100644
--- a/llvm/include/llvm/Support/PointerLikeTypeTraits.h
+++ b/llvm/include/llvm/Support/PointerLikeTypeTraits.h
@@ -70,7 +70,7 @@ template <> struct PointerLikeTypeTraits<void *> {
// Provide PointerLikeTypeTraits for const things.
template <typename T> struct PointerLikeTypeTraits<const T> {
- typedef PointerLikeTypeTraits<T> NonConst;
+ using NonConst = PointerLikeTypeTraits<T>;
static inline const void *getAsVoidPointer(const T P) {
return NonConst::getAsVoidPointer(P);
@@ -83,7 +83,7 @@ template <typename T> struct PointerLikeTypeTraits<const T> {
// Provide PointerLikeTypeTraits for const pointers.
template <typename T> struct PointerLikeTypeTraits<const T *> {
- typedef PointerLikeTypeTraits<T *> NonConst;
+ using NonConst = PointerLikeTypeTraits<T *>;
static inline const void *getAsVoidPointer(const T *P) {
return NonConst::getAsVoidPointer(const_cast<T *>(P));
diff --git a/llvm/include/llvm/Support/Program.h b/llvm/include/llvm/Support/Program.h
index 53c2e75..575e416 100644
--- a/llvm/include/llvm/Support/Program.h
+++ b/llvm/include/llvm/Support/Program.h
@@ -39,8 +39,8 @@ const char EnvPathSeparator = ';';
typedef unsigned long procid_t; // Must match the type of DWORD on Windows.
typedef void *process_t; // Must match the type of HANDLE on Windows.
#else
-typedef ::pid_t procid_t;
-typedef procid_t process_t;
+using procid_t = ::pid_t;
+using process_t = procid_t;
#endif
/// This struct encapsulates information about a process.
diff --git a/llvm/include/llvm/Support/RISCVISAUtils.h b/llvm/include/llvm/Support/RISCVISAUtils.h
index 165bb08..05fd32e 100644
--- a/llvm/include/llvm/Support/RISCVISAUtils.h
+++ b/llvm/include/llvm/Support/RISCVISAUtils.h
@@ -40,8 +40,8 @@ struct ExtensionComparator {
/// OrderedExtensionMap is std::map, it's specialized to keep entries
/// in canonical order of extension.
-typedef std::map<std::string, ExtensionVersion, ExtensionComparator>
- OrderedExtensionMap;
+using OrderedExtensionMap =
+ std::map<std::string, ExtensionVersion, ExtensionComparator>;
} // namespace RISCVISAUtils
diff --git a/llvm/include/llvm/Support/RWMutex.h b/llvm/include/llvm/Support/RWMutex.h
index 8d221aa..efc1ca1 100644
--- a/llvm/include/llvm/Support/RWMutex.h
+++ b/llvm/include/llvm/Support/RWMutex.h
@@ -162,7 +162,7 @@ public:
bool try_lock() { return impl.try_lock(); }
};
-typedef SmartRWMutex<false> RWMutex;
+using RWMutex = SmartRWMutex<false>;
/// ScopedReader - RAII acquisition of a reader lock
#if !defined(LLVM_USE_RW_MUTEX_IMPL)
@@ -179,7 +179,7 @@ template <bool mt_only> struct SmartScopedReader {
~SmartScopedReader() { mutex.unlock_shared(); }
};
#endif
-typedef SmartScopedReader<false> ScopedReader;
+using ScopedReader = SmartScopedReader<false>;
/// ScopedWriter - RAII acquisition of a writer lock
#if !defined(LLVM_USE_RW_MUTEX_IMPL)
@@ -196,7 +196,7 @@ template <bool mt_only> struct SmartScopedWriter {
~SmartScopedWriter() { mutex.unlock(); }
};
#endif
-typedef SmartScopedWriter<false> ScopedWriter;
+using ScopedWriter = SmartScopedWriter<false>;
} // end namespace sys
} // end namespace llvm
diff --git a/llvm/include/llvm/Support/Registry.h b/llvm/include/llvm/Support/Registry.h
index c02f15e..acd3b06 100644
--- a/llvm/include/llvm/Support/Registry.h
+++ b/llvm/include/llvm/Support/Registry.h
@@ -43,8 +43,8 @@ namespace llvm {
template <typename T>
class Registry {
public:
- typedef T type;
- typedef SimpleRegistryEntry<T> entry;
+ using type = T;
+ using entry = SimpleRegistryEntry<T>;
class node;
class iterator;
diff --git a/llvm/include/llvm/Support/ScaledNumber.h b/llvm/include/llvm/Support/ScaledNumber.h
index 07baf15..8ca8d457e 100644
--- a/llvm/include/llvm/Support/ScaledNumber.h
+++ b/llvm/include/llvm/Support/ScaledNumber.h
@@ -498,10 +498,10 @@ public:
static_assert(!std::numeric_limits<DigitsT>::is_signed,
"only unsigned floats supported");
- typedef DigitsT DigitsType;
+ using DigitsType = DigitsT;
private:
- typedef std::numeric_limits<DigitsType> DigitsLimits;
+ using DigitsLimits = std::numeric_limits<DigitsType>;
static constexpr int Width = sizeof(DigitsType) * 8;
static_assert(Width <= 64, "invalid integer width for digits");
@@ -782,7 +782,7 @@ uint64_t ScaledNumber<DigitsT>::scale(uint64_t N) const {
template <class DigitsT>
template <class IntT>
IntT ScaledNumber<DigitsT>::toInt() const {
- typedef std::numeric_limits<IntT> Limits;
+ using Limits = std::numeric_limits<IntT>;
if (*this < 1)
return 0;
if (*this >= Limits::max())
diff --git a/llvm/include/llvm/Support/SuffixTree.h b/llvm/include/llvm/Support/SuffixTree.h
index 4c78235..eac66d8 100644
--- a/llvm/include/llvm/Support/SuffixTree.h
+++ b/llvm/include/llvm/Support/SuffixTree.h
@@ -219,7 +219,7 @@ public:
}
};
- typedef RepeatedSubstringIterator iterator;
+ using iterator = RepeatedSubstringIterator;
iterator begin() { return iterator(Root, LeafNodes); }
iterator end() { return iterator(nullptr); }
};
diff --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h
index 8884680..89d90b3 100644
--- a/llvm/include/llvm/Support/Threading.h
+++ b/llvm/include/llvm/Support/Threading.h
@@ -53,7 +53,7 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
#if LLVM_THREADING_USE_STD_CALL_ONCE
- typedef std::once_flag once_flag;
+using once_flag = std::once_flag;
#else
diff --git a/llvm/include/llvm/Support/TrailingObjects.h b/llvm/include/llvm/Support/TrailingObjects.h
index c479765..218c2e3 100644
--- a/llvm/include/llvm/Support/TrailingObjects.h
+++ b/llvm/include/llvm/Support/TrailingObjects.h
@@ -76,7 +76,7 @@ protected:
// number of a different type. e.g.:
// ExtractSecondType<Foo..., int>::type
template <typename Ty1, typename Ty2> struct ExtractSecondType {
- typedef Ty2 type;
+ using type = Ty2;
};
// TrailingObjectsImpl is somewhat complicated, because it is a
@@ -101,8 +101,8 @@ class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy, NextTy,
: public TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, NextTy,
MoreTys...> {
- typedef TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, NextTy, MoreTys...>
- ParentType;
+ using ParentType =
+ TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, NextTy, MoreTys...>;
struct RequiresRealignment {
static const bool value = alignof(PrevTy) < alignof(NextTy);
diff --git a/llvm/include/llvm/Support/UnicodeCharRanges.h b/llvm/include/llvm/Support/UnicodeCharRanges.h
index 7f1a9b3..2b5fc83 100644
--- a/llvm/include/llvm/Support/UnicodeCharRanges.h
+++ b/llvm/include/llvm/Support/UnicodeCharRanges.h
@@ -37,7 +37,7 @@ inline bool operator<(UnicodeCharRange Range, uint32_t Value) {
/// array.
class UnicodeCharSet {
public:
- typedef ArrayRef<UnicodeCharRange> CharRanges;
+ using CharRanges = ArrayRef<UnicodeCharRange>;
/// Constructs a UnicodeCharSet instance from an array of
/// UnicodeCharRanges.
diff --git a/llvm/include/llvm/Support/float128.h b/llvm/include/llvm/Support/float128.h
index e15a98d..ffad124 100644
--- a/llvm/include/llvm/Support/float128.h
+++ b/llvm/include/llvm/Support/float128.h
@@ -14,7 +14,7 @@ namespace llvm {
#if defined(__clang__) && defined(__FLOAT128__) && \
defined(__SIZEOF_INT128__) && !defined(__LONG_DOUBLE_IBM128__)
#define HAS_IEE754_FLOAT128
-typedef __float128 float128;
+using float128 = __float128;
#elif defined(__FLOAT128__) && defined(__SIZEOF_INT128__) && \
!defined(__LONG_DOUBLE_IBM128__) && \
(defined(__GNUC__) || defined(__GNUG__))
diff --git a/llvm/include/llvm/Support/thread.h b/llvm/include/llvm/Support/thread.h
index 16e322b..ecde62d 100644
--- a/llvm/include/llvm/Support/thread.h
+++ b/llvm/include/llvm/Support/thread.h
@@ -127,7 +127,7 @@ LLVM_ABI thread::id llvm_thread_get_current_id_impl();
template <class Function, class... Args>
thread::thread(std::optional<unsigned> StackSizeInBytes, Function &&f,
Args &&...args) {
- typedef std::tuple<std::decay_t<Function>, std::decay_t<Args>...> CalleeTuple;
+ using CalleeTuple = std::tuple<std::decay_t<Function>, std::decay_t<Args>...>;
std::unique_ptr<CalleeTuple> Callee(
new CalleeTuple(std::forward<Function>(f), std::forward<Args>(args)...));
diff --git a/llvm/include/llvm/TableGen/CodeGenHelpers.h b/llvm/include/llvm/TableGen/CodeGenHelpers.h
index e22c6d4..95866e3 100644
--- a/llvm/include/llvm/TableGen/CodeGenHelpers.h
+++ b/llvm/include/llvm/TableGen/CodeGenHelpers.h
@@ -20,6 +20,7 @@
#include <string>
namespace llvm {
+
// Simple RAII helper for emitting ifdef-undef-endif scope.
class IfDefEmitter {
public:
@@ -57,7 +58,7 @@ public:
NamespaceEmitter(raw_ostream &OS, StringRef NameUntrimmed)
: Name(trim(NameUntrimmed).str()), OS(OS) {
if (!Name.empty())
- OS << "namespace " << Name << " {\n";
+ OS << "namespace " << Name << " {\n\n";
}
~NamespaceEmitter() { close(); }
@@ -65,7 +66,7 @@ public:
// Explicit function to close the namespace scopes.
void close() {
if (!Closed && !Name.empty())
- OS << "} // namespace " << Name << "\n";
+ OS << "\n} // namespace " << Name << "\n";
Closed = true;
}
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index a013f27..eb35e36 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -5339,6 +5339,19 @@ struct AAPotentialConstantValues
return nullptr;
}
+ /// Return the minimum trailing zeros of potential constants
+ unsigned getAssumedMinTrailingZeros() const {
+ if (!isValidState() || getAssumedSet().empty())
+ return 0;
+ unsigned TrailingZeros = getAssumedSet().begin()->getBitWidth() + 1;
+ for (const APInt &It : getAssumedSet()) {
+ if (It.countTrailingZeros() < TrailingZeros)
+ TrailingZeros = It.countTrailingZeros();
+ }
+ if (TrailingZeros > getAssumedSet().begin()->getBitWidth())
+ return 0;
+ return TrailingZeros;
+ }
/// See AbstractAttribute::getName()
StringRef getName() const override { return "AAPotentialConstantValues"; }