diff options
Diffstat (limited to 'contrib/llvm-project/llvm/include')
233 files changed, 1485 insertions, 1143 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm-c/Core.h b/contrib/llvm-project/llvm/include/llvm-c/Core.h index ca3ca24487a5..09d80841fa5d 100644 --- a/contrib/llvm-project/llvm/include/llvm-c/Core.h +++ b/contrib/llvm-project/llvm/include/llvm-c/Core.h @@ -18,6 +18,7 @@ #include "llvm-c/Deprecated.h" #include "llvm-c/ErrorHandling.h" #include "llvm-c/ExternC.h" + #include "llvm-c/Types.h" LLVM_C_EXTERN_C_BEGIN diff --git a/contrib/llvm-project/llvm/include/llvm-c/DebugInfo.h b/contrib/llvm-project/llvm/include/llvm-c/DebugInfo.h index a515533f38e2..8554a0199873 100644 --- a/contrib/llvm-project/llvm/include/llvm-c/DebugInfo.h +++ b/contrib/llvm-project/llvm/include/llvm-c/DebugInfo.h @@ -16,8 +16,8 @@ #ifndef LLVM_C_DEBUGINFO_H #define LLVM_C_DEBUGINFO_H -#include "llvm-c/Core.h" #include "llvm-c/ExternC.h" +#include "llvm-c/Types.h" LLVM_C_EXTERN_C_BEGIN diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/APFixedPoint.h b/contrib/llvm-project/llvm/include/llvm/ADT/APFixedPoint.h index d6349e6b2a88..92cabdd9f9e4 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/APFixedPoint.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/APFixedPoint.h @@ -5,12 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// +/// /// \file /// Defines the fixed point number interface. /// This is a class for abstracting various operations performed on fixed point /// types. -// +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_APFIXEDPOINT_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/APFloat.h b/contrib/llvm-project/llvm/include/llvm/ADT/APFloat.h index 40e0e32c77a8..17b57de7b0aa 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/APFloat.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/APFloat.h @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief /// This file declares a class to represent arbitrary precision floating point /// values and provide a variety of arithmetic operations on them. /// diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h b/contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h index c1cf3c546070..7b6af436f577 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h @@ -5,10 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file implements the APSInt class, which is a simple class that -// represents an arbitrary sized integer that knows its signedness. -// +/// +/// \file +/// This file implements the APSInt class, which is a simple class that +/// represents an arbitrary sized integer that knows its signedness. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_APSINT_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Any.h b/contrib/llvm-project/llvm/include/llvm/ADT/Any.h index 1b4f2c2fa985..1c7ba0371781 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/Any.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/Any.h @@ -5,11 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file provides Any, a non-template class modeled in the spirit of -// std::any. The idea is to provide a type-safe replacement for C's void*. -// It can hold a value of any copy-constructible copy-assignable type -// +/// +/// \file +/// This file provides Any, a non-template class modeled in the spirit of +/// std::any. The idea is to provide a type-safe replacement for C's void*. +/// It can hold a value of any copy-constructible copy-assignable type +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_ANY_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/BitVector.h b/contrib/llvm-project/llvm/include/llvm/ADT/BitVector.h index fff4a8f578d2..9540b3985963 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/BitVector.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/BitVector.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file implements the BitVector class. -// +/// +/// \file +/// This file implements the BitVector class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_BITVECTOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/BreadthFirstIterator.h b/contrib/llvm-project/llvm/include/llvm/ADT/BreadthFirstIterator.h index 7d728a23b19a..1312b5f91e83 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/BreadthFirstIterator.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/BreadthFirstIterator.h @@ -5,13 +5,14 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file builds on the ADT/GraphTraits.h file to build a generic breadth -// first graph iterator. This file exposes the following functions/types: -// -// bf_begin/bf_end/bf_iterator -// * Normal breadth-first iteration - visit a graph level-by-level. -// +/// +/// \file +/// This file builds on the ADT/GraphTraits.h file to build a generic breadth +/// first graph iterator. This file exposes the following functions/types: +/// +/// bf_begin/bf_end/bf_iterator +/// * Normal breadth-first iteration - visit a graph level-by-level. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_BREADTHFIRSTITERATOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/CachedHashString.h b/contrib/llvm-project/llvm/include/llvm/ADT/CachedHashString.h index 785bd07b3a44..ebd40e320715 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/CachedHashString.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/CachedHashString.h @@ -5,15 +5,16 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines CachedHashString and CachedHashStringRef. These are owning -// and not-owning string types that store their hash in addition to their string -// data. -// -// Unlike std::string, CachedHashString can be used in DenseSet/DenseMap -// (because, unlike std::string, CachedHashString lets us have empty and -// tombstone values). -// +/// +/// \file +/// This file defines CachedHashString and CachedHashStringRef. These are +/// owning and not-owning string types that store their hash in addition to +/// their string data. +/// +/// Unlike std::string, CachedHashString can be used in DenseSet/DenseMap +/// (because, unlike std::string, CachedHashString lets us have empty and +/// tombstone values). +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_CACHEDHASHSTRING_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/CoalescingBitVector.h b/contrib/llvm-project/llvm/include/llvm/ADT/CoalescingBitVector.h index 6935c255a099..4940bc1c2c18 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/CoalescingBitVector.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/CoalescingBitVector.h @@ -6,7 +6,8 @@ // //===----------------------------------------------------------------------===// /// -/// \file A bitvector that uses an IntervalMap to coalesce adjacent elements +/// \file +/// A bitvector that uses an IntervalMap to coalesce adjacent elements /// into intervals. /// //===----------------------------------------------------------------------===// diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/DenseMap.h b/contrib/llvm-project/llvm/include/llvm/ADT/DenseMap.h index 595eabd0ffb4..7673b66ca42a 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/DenseMap.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/DenseMap.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the DenseMap class. -// +/// +/// \file +/// This file defines the DenseMap class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_DENSEMAP_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h b/contrib/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h index 75b7371a3683..afd478f0b849 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines DenseMapInfo traits for DenseMap. -// +/// +/// \file +/// This file defines DenseMapInfo traits for DenseMap. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_DENSEMAPINFO_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/DenseSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/DenseSet.h index e767211a0900..b89c88626e43 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/DenseSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/DenseSet.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the DenseSet and SmallDenseSet classes. -// +/// +/// \file +/// This file defines the DenseSet and SmallDenseSet classes. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_DENSESET_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/DepthFirstIterator.h b/contrib/llvm-project/llvm/include/llvm/ADT/DepthFirstIterator.h index 42ac61d7cf52..cea6fbcd9d29 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/DepthFirstIterator.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/DepthFirstIterator.h @@ -5,28 +5,30 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file builds on the ADT/GraphTraits.h file to build generic depth -// first graph iterator. This file exposes the following functions/types: -// -// df_begin/df_end/df_iterator -// * Normal depth-first iteration - visit a node and then all of its children. -// -// idf_begin/idf_end/idf_iterator -// * Depth-first iteration on the 'inverse' graph. -// -// df_ext_begin/df_ext_end/df_ext_iterator -// * Normal depth-first iteration - visit a node and then all of its children. -// This iterator stores the 'visited' set in an external set, which allows -// it to be more efficient, and allows external clients to use the set for -// other purposes. -// -// idf_ext_begin/idf_ext_end/idf_ext_iterator -// * Depth-first iteration on the 'inverse' graph. -// This iterator stores the 'visited' set in an external set, which allows -// it to be more efficient, and allows external clients to use the set for -// other purposes. -// +/// +/// \file +/// This file builds on the ADT/GraphTraits.h file to build generic depth +/// first graph iterator. This file exposes the following functions/types: +/// +/// df_begin/df_end/df_iterator +/// * Normal depth-first iteration - visit a node and then all of its +/// children. +/// +/// idf_begin/idf_end/idf_iterator +/// * Depth-first iteration on the 'inverse' graph. +/// +/// df_ext_begin/df_ext_end/df_ext_iterator +/// * Normal depth-first iteration - visit a node and then all of its +/// children. This iterator stores the 'visited' set in an external set, +/// which allows it to be more efficient, and allows external clients to +/// use the set for other purposes. +/// +/// idf_ext_begin/idf_ext_end/idf_ext_iterator +/// * Depth-first iteration on the 'inverse' graph. +/// This iterator stores the 'visited' set in an external set, which +/// allows it to be more efficient, and allows external clients to use +/// the set for other purposes. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_DEPTHFIRSTITERATOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/DirectedGraph.h b/contrib/llvm-project/llvm/include/llvm/ADT/DirectedGraph.h index e8bb9e6b2292..83c0bea6393c 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/DirectedGraph.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/DirectedGraph.h @@ -5,10 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the interface and a base class implementation for a -// directed graph. -// +/// +/// \file +/// This file defines the interface and a base class implementation for a +/// directed graph. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_DIRECTEDGRAPH_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/EnumeratedArray.h b/contrib/llvm-project/llvm/include/llvm/ADT/EnumeratedArray.h index a66ec9d08c37..f54a50446c6e 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/EnumeratedArray.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/EnumeratedArray.h @@ -5,9 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines an array type that can be indexed using scoped enum values. -// +/// +/// \file +/// This file defines an array type that can be indexed using scoped enum +/// values. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_ENUMERATEDARRAY_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/EpochTracker.h b/contrib/llvm-project/llvm/include/llvm/ADT/EpochTracker.h index 7a2e4220afec..b06888494466 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/EpochTracker.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/EpochTracker.h @@ -5,11 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the DebugEpochBase and DebugEpochBase::HandleBase classes. -// These can be used to write iterators that are fail-fast when LLVM is built -// with asserts enabled. -// +/// +/// \file +/// This file defines the DebugEpochBase and DebugEpochBase::HandleBase classes. +/// These can be used to write iterators that are fail-fast when LLVM is built +/// with asserts enabled. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_EPOCHTRACKER_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/EquivalenceClasses.h b/contrib/llvm-project/llvm/include/llvm/ADT/EquivalenceClasses.h index de6bb3bca7e3..f12b683ead2d 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/EquivalenceClasses.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/EquivalenceClasses.h @@ -5,10 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// Generic implementation of equivalence classes through the use Tarjan's -// efficient union-find algorithm. -// +/// +/// \file +/// Generic implementation of equivalence classes through the use Tarjan's +/// efficient union-find algorithm. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_EQUIVALENCECLASSES_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h b/contrib/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h index 62c127a49620..9cc69b8a8344 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// Utilities for dealing with flags related to floating point mode controls. -// +/// +/// \file +/// Utilities for dealing with flags related to floating point mode controls. +/// //===----------------------------------------------------------------------===/ #ifndef LLVM_ADT_FLOATINGPOINTMODE_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/FoldingSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/FoldingSet.h index fb1cb03a4b5c..a8707f0ee81e 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/FoldingSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/FoldingSet.h @@ -5,11 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines a hash set that can be used to remove duplication of nodes -// in a graph. This code was originally created by Chris Lattner for use with -// SelectionDAGCSEMap, but was isolated to provide use across the llvm code set. -// +/// +/// \file +/// This file defines a hash set that can be used to remove duplication of nodes +/// in a graph. This code was originally created by Chris Lattner for use with +/// SelectionDAGCSEMap, but was isolated to provide use across the llvm code +/// set. //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_FOLDINGSET_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/GenericCycleImpl.h b/contrib/llvm-project/llvm/include/llvm/ADT/GenericCycleImpl.h index 5f29236eac47..d443f9e21a47 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/GenericCycleImpl.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/GenericCycleImpl.h @@ -5,18 +5,19 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This template implementation resides in a separate file so that it -// does not get injected into every .cpp file that includes the -// generic header. -// -// DO NOT INCLUDE THIS FILE WHEN MERELY USING CYCLEINFO. -// -// This file should only be included by files that implement a -// specialization of the relevant templates. Currently these are: -// - CycleAnalysis.cpp -// - MachineCycleAnalysis.cpp -// +/// +/// \file +/// This template implementation resides in a separate file so that it +/// does not get injected into every .cpp file that includes the +/// generic header. +/// +/// DO NOT INCLUDE THIS FILE WHEN MERELY USING CYCLEINFO. +/// +/// This file should only be included by files that implement a +/// specialization of the relevant templates. Currently these are: +/// - CycleAnalysis.cpp +/// - MachineCycleAnalysis.cpp +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_GENERICCYCLEIMPL_H @@ -77,7 +78,7 @@ template <typename ContextT> class GenericCycleInfoCompute { unsigned Start = 0; // DFS start; positive if block is found unsigned End = 0; // DFS end - DFSInfo() {} + DFSInfo() = default; explicit DFSInfo(unsigned Start) : Start(Start) {} /// Whether this node is an ancestor (or equal to) the node \p Other diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/GenericCycleInfo.h b/contrib/llvm-project/llvm/include/llvm/ADT/GenericCycleInfo.h index 7768253e121d..d5f9cd9142ac 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/GenericCycleInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/GenericCycleInfo.h @@ -5,7 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// +/// /// \file /// \brief Find all cycles in a control-flow graph, including irreducible loops. /// @@ -22,7 +22,7 @@ /// unique cycle C which is a superset of L. /// - In the absence of irreducible control flow, the cycles are /// exactly the natural loops in the program. -// +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_GENERICCYCLEINFO_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/GraphTraits.h b/contrib/llvm-project/llvm/include/llvm/ADT/GraphTraits.h index 3ce91225d80d..3a7773592af3 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/GraphTraits.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/GraphTraits.h @@ -5,13 +5,15 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the little GraphTraits<X> template class that should be -// specialized by classes that want to be iteratable by generic graph iterators. -// -// This file also defines the marker class Inverse that is used to iterate over -// graphs in a graph defined, inverse ordering... -// +/// +/// \file +/// This file defines the little GraphTraits<X> template class that should be +/// specialized by classes that want to be iteratable by generic graph +/// iterators. +/// +/// This file also defines the marker class Inverse that is used to iterate over +/// graphs in a graph defined, inverse ordering... +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_GRAPHTRAITS_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableList.h b/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableList.h index cf27c5a16d28..23f82691825c 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableList.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableList.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the ImmutableList class. -// +/// +/// \file +/// This file defines the ImmutableList class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_IMMUTABLELIST_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableMap.h b/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableMap.h index f0e898cafaf9..c9351b3213dc 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableMap.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableMap.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the ImmutableMap class. -// +/// +/// \file +/// This file defines the ImmutableMap class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_IMMUTABLEMAP_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableSet.h index 8cef5acbafaa..b513fe9ec011 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableSet.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the ImutAVLTree and ImmutableSet classes. -// +/// +/// \file +/// This file defines the ImutAVLTree and ImmutableSet classes. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_IMMUTABLESET_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/IndexedMap.h b/contrib/llvm-project/llvm/include/llvm/ADT/IndexedMap.h index b44f16b91d76..5ac5f798269b 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/IndexedMap.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/IndexedMap.h @@ -5,15 +5,16 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file implements an indexed map. The index map template takes two -// types. The first is the mapped type and the second is a functor -// that maps its argument to a size_t. On instantiation a "null" value -// can be provided to be used as a "does not exist" indicator in the -// map. A member function grow() is provided that given the value of -// the maximally indexed key (the argument of the functor) makes sure -// the map has enough space for it. -// +/// +/// \file +/// This file implements an indexed map. The index map template takes two +/// types. The first is the mapped type and the second is a functor +/// that maps its argument to a size_t. On instantiation a "null" value +/// can be provided to be used as a "does not exist" indicator in the +/// map. A member function grow() is provided that given the value of +/// the maximally indexed key (the argument of the functor) makes sure +/// the map has enough space for it. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_INDEXEDMAP_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/IntEqClasses.h b/contrib/llvm-project/llvm/include/llvm/ADT/IntEqClasses.h index 08f46a3079ef..84bb58cb736c 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/IntEqClasses.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/IntEqClasses.h @@ -5,16 +5,17 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// Equivalence classes for small integers. This is a mapping of the integers -// 0 .. N-1 into M equivalence classes numbered 0 .. M-1. -// -// Initially each integer has its own equivalence class. Classes are joined by -// passing a representative member of each class to join(). -// -// Once the classes are built, compress() will number them 0 .. M-1 and prevent -// further changes. -// +/// +/// \file +/// Equivalence classes for small integers. This is a mapping of the integers +/// 0 .. N-1 into M equivalence classes numbered 0 .. M-1. +/// +/// Initially each integer has its own equivalence class. Classes are joined by +/// passing a representative member of each class to join(). +/// +/// Once the classes are built, compress() will number them 0 .. M-1 and prevent +/// further changes. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_INTEQCLASSES_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/IntervalMap.h b/contrib/llvm-project/llvm/include/llvm/ADT/IntervalMap.h index 3c107a3622a9..368ed46f98d2 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/IntervalMap.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/IntervalMap.h @@ -5,30 +5,31 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file implements a coalescing interval map for small objects. -// -// KeyT objects are mapped to ValT objects. Intervals of keys that map to the -// same value are represented in a compressed form. -// -// Iterators provide ordered access to the compressed intervals rather than the -// individual keys, and insert and erase operations use key intervals as well. -// -// Like SmallVector, IntervalMap will store the first N intervals in the map -// object itself without any allocations. When space is exhausted it switches to -// a B+-tree representation with very small overhead for small key and value -// objects. -// -// A Traits class specifies how keys are compared. It also allows IntervalMap to -// work with both closed and half-open intervals. -// -// Keys and values are not stored next to each other in a std::pair, so we don't -// provide such a value_type. Dereferencing iterators only returns the mapped -// value. The interval bounds are accessible through the start() and stop() -// iterator methods. -// -// IntervalMap is optimized for small key and value objects, 4 or 8 bytes each -// is the optimal size. For large objects use std::map instead. +/// +/// \file +/// This file implements a coalescing interval map for small objects. +/// +/// KeyT objects are mapped to ValT objects. Intervals of keys that map to the +/// same value are represented in a compressed form. +/// +/// Iterators provide ordered access to the compressed intervals rather than the +/// individual keys, and insert and erase operations use key intervals as well. +/// +/// Like SmallVector, IntervalMap will store the first N intervals in the map +/// object itself without any allocations. When space is exhausted it switches +/// to a B+-tree representation with very small overhead for small key and +/// value objects. +/// +/// A Traits class specifies how keys are compared. It also allows IntervalMap +/// to work with both closed and half-open intervals. +/// +/// Keys and values are not stored next to each other in a std::pair, so we +/// don't provide such a value_type. Dereferencing iterators only returns the +/// mapped value. The interval bounds are accessible through the start() and +/// stop() iterator methods. +/// +/// IntervalMap is optimized for small key and value objects, 4 or 8 bytes +/// each is the optimal size. For large objects use std::map instead. // //===----------------------------------------------------------------------===// // diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h b/contrib/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h index 9715c9d01b98..975535bb5676 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h @@ -5,51 +5,56 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the RefCountedBase, ThreadSafeRefCountedBase, and -// IntrusiveRefCntPtr classes. -// -// IntrusiveRefCntPtr is a smart pointer to an object which maintains a -// reference count. (ThreadSafe)RefCountedBase is a mixin class that adds a -// refcount member variable and methods for updating the refcount. An object -// that inherits from (ThreadSafe)RefCountedBase deletes itself when its -// refcount hits zero. -// -// For example: -// -// class MyClass : public RefCountedBase<MyClass> {}; -// -// void foo() { -// // Constructing an IntrusiveRefCntPtr increases the pointee's refcount by -// // 1 (from 0 in this case). -// IntrusiveRefCntPtr<MyClass> Ptr1(new MyClass()); -// -// // Copying an IntrusiveRefCntPtr increases the pointee's refcount by 1. -// IntrusiveRefCntPtr<MyClass> Ptr2(Ptr1); -// -// // Constructing an IntrusiveRefCntPtr has no effect on the object's -// // refcount. After a move, the moved-from pointer is null. -// IntrusiveRefCntPtr<MyClass> Ptr3(std::move(Ptr1)); -// assert(Ptr1 == nullptr); -// -// // Clearing an IntrusiveRefCntPtr decreases the pointee's refcount by 1. -// Ptr2.reset(); -// -// // The object deletes itself when we return from the function, because -// // Ptr3's destructor decrements its refcount to 0. -// } -// -// You can use IntrusiveRefCntPtr with isa<T>(), dyn_cast<T>(), etc.: -// -// IntrusiveRefCntPtr<MyClass> Ptr(new MyClass()); -// OtherClass *Other = dyn_cast<OtherClass>(Ptr); // Ptr.get() not required -// -// IntrusiveRefCntPtr works with any class that -// -// - inherits from (ThreadSafe)RefCountedBase, -// - has Retain() and Release() methods, or -// - specializes IntrusiveRefCntPtrInfo. -// +/// +/// \file +/// This file defines the RefCountedBase, ThreadSafeRefCountedBase, and +/// IntrusiveRefCntPtr classes. +/// +/// IntrusiveRefCntPtr is a smart pointer to an object which maintains a +/// reference count. (ThreadSafe)RefCountedBase is a mixin class that adds a +/// refcount member variable and methods for updating the refcount. An object +/// that inherits from (ThreadSafe)RefCountedBase deletes itself when its +/// refcount hits zero. +/// +/// For example: +/// +/// ``` +/// class MyClass : public RefCountedBase<MyClass> {}; +/// +/// void foo() { +/// // Constructing an IntrusiveRefCntPtr increases the pointee's refcount +/// // by 1 (from 0 in this case). +/// IntrusiveRefCntPtr<MyClass> Ptr1(new MyClass()); +/// +/// // Copying an IntrusiveRefCntPtr increases the pointee's refcount by 1. +/// IntrusiveRefCntPtr<MyClass> Ptr2(Ptr1); +/// +/// // Constructing an IntrusiveRefCntPtr has no effect on the object's +/// // refcount. After a move, the moved-from pointer is null. +/// IntrusiveRefCntPtr<MyClass> Ptr3(std::move(Ptr1)); +/// assert(Ptr1 == nullptr); +/// +/// // Clearing an IntrusiveRefCntPtr decreases the pointee's refcount by 1. +/// Ptr2.reset(); +/// +/// // The object deletes itself when we return from the function, because +/// // Ptr3's destructor decrements its refcount to 0. +/// } +/// ``` +/// +/// You can use IntrusiveRefCntPtr with isa<T>(), dyn_cast<T>(), etc.: +/// +/// ``` +/// IntrusiveRefCntPtr<MyClass> Ptr(new MyClass()); +/// OtherClass *Other = dyn_cast<OtherClass>(Ptr); // Ptr.get() not required +/// ``` +/// +/// IntrusiveRefCntPtr works with any class that +/// +/// - inherits from (ThreadSafe)RefCountedBase, +/// - has Retain() and Release() methods, or +/// - specializes IntrusiveRefCntPtrInfo. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_INTRUSIVEREFCNTPTR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/MapVector.h b/contrib/llvm-project/llvm/include/llvm/ADT/MapVector.h index d281166b3e19..c4e5c7e2bac5 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/MapVector.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/MapVector.h @@ -5,12 +5,13 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file implements a map that provides insertion order iteration. The -// interface is purposefully minimal. The key is assumed to be cheap to copy -// and 2 copies are kept, one for indexing in a DenseMap, one for iteration in -// a std::vector. -// +/// +/// \file +/// This file implements a map that provides insertion order iteration. The +/// interface is purposefully minimal. The key is assumed to be cheap to copy +/// and 2 copies are kept, one for indexing in a DenseMap, one for iteration in +/// a std::vector. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_MAPVECTOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/None.h b/contrib/llvm-project/llvm/include/llvm/ADT/None.h index 004ca0ac50ac..1a66be4097df 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/None.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/None.h @@ -5,11 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file provides None, an enumerator for use in implicit constructors -// of various (usually templated) types to make such construction more -// terse. -// +/// +/// \file +/// This file provides None, an enumerator for use in implicit constructors +/// of various (usually templated) types to make such construction more +/// terse. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_NONE_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Optional.h b/contrib/llvm-project/llvm/include/llvm/ADT/Optional.h index 7d6b3e92f6b2..e047b0fc6514 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/Optional.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/Optional.h @@ -5,11 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file provides Optional, a template class modeled in the spirit of -// OCaml's 'opt' variant. The idea is to strongly type whether or not -// a value can be optional. -// +/// +/// \file +/// This file provides Optional, a template class modeled in the spirit of +/// OCaml's 'opt' variant. The idea is to strongly type whether or not +/// a value can be optional. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_OPTIONAL_H @@ -241,7 +242,7 @@ template <typename T> class Optional { public: using value_type = T; - constexpr Optional() {} + constexpr Optional() = default; constexpr Optional(NoneType) {} constexpr Optional(const T &y) : Storage(in_place, y) {} diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PackedVector.h b/contrib/llvm-project/llvm/include/llvm/ADT/PackedVector.h index ae7f8cc85743..b448685ab616 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PackedVector.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PackedVector.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file implements the PackedVector class. -// +/// +/// \file +/// This file implements the PackedVector class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_PACKEDVECTOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h b/contrib/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h index 393ace6b70fc..b7ddf8855605 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the PointerIntPair class. -// +/// +/// \file +/// This file defines the PointerIntPair class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_POINTERINTPAIR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PointerUnion.h b/contrib/llvm-project/llvm/include/llvm/ADT/PointerUnion.h index 5ce2dbee4b3a..04d566bbc75e 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PointerUnion.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PointerUnion.h @@ -5,10 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the PointerUnion class, which is a discriminated union of -// pointer types. -// +/// +/// \file +/// This file defines the PointerUnion class, which is a discriminated union of +/// pointer types. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_POINTERUNION_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PostOrderIterator.h b/contrib/llvm-project/llvm/include/llvm/ADT/PostOrderIterator.h index 74314d39d825..d0366045fa09 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PostOrderIterator.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PostOrderIterator.h @@ -5,11 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file builds on the ADT/GraphTraits.h file to build a generic graph -// post order iterator. This should work over any graph type that has a -// GraphTraits specialization. -// +/// +/// \file +/// This file builds on the ADT/GraphTraits.h file to build a generic graph +/// post order iterator. This should work over any graph type that has a +/// GraphTraits specialization. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_POSTORDERITERATOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PriorityQueue.h b/contrib/llvm-project/llvm/include/llvm/ADT/PriorityQueue.h index cf79ee10ba7f..f40c160f0f5e 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PriorityQueue.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PriorityQueue.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the PriorityQueue class. -// +/// +/// \file +/// This file defines the PriorityQueue class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_PRIORITYQUEUE_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/STLArrayExtras.h b/contrib/llvm-project/llvm/include/llvm/ADT/STLArrayExtras.h new file mode 100644 index 000000000000..5b666641580e --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm/ADT/STLArrayExtras.h @@ -0,0 +1,35 @@ +//===- llvm/ADT/STLArrayExtras.h - additions to <array> ---------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// This file contains some templates that are useful if you are working with the +// STL at all. +// +// No library is required when using these functions. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_STLARRAYEXTRAS_H +#define LLVM_ADT_STLARRAYEXTRAS_H + +#include <cstddef> + +namespace llvm { + +//===----------------------------------------------------------------------===// +// Extra additions for arrays +//===----------------------------------------------------------------------===// + +/// Find the length of an array. +template <class T, std::size_t N> +constexpr inline size_t array_lengthof(T (&)[N]) { + return N; +} + +} // end namespace llvm + +#endif // LLVM_ADT_STLARRAYEXTRAS_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/STLExtras.h b/contrib/llvm-project/llvm/include/llvm/ADT/STLExtras.h index c3200c926518..e2972f4f902a 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/STLExtras.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/STLExtras.h @@ -5,21 +5,23 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file contains some templates that are useful if you are working with the -// STL at all. -// -// No library is required when using these functions. -// +/// +/// \file +/// This file contains some templates that are useful if you are working with +/// the STL at all. +/// +/// No library is required when using these functions. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_STLEXTRAS_H #define LLVM_ADT_STLEXTRAS_H -#include "llvm/ADT/identity.h" #include "llvm/ADT/Optional.h" +#include "llvm/ADT/STLArrayExtras.h" #include "llvm/ADT/STLForwardCompat.h" #include "llvm/ADT/STLFunctionalExtras.h" +#include "llvm/ADT/identity.h" #include "llvm/ADT/iterator.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Config/abi-breaking.h" @@ -1410,7 +1412,7 @@ constexpr decltype(auto) makeVisitor(CallableTs &&...Callables) { } //===----------------------------------------------------------------------===// -// Extra additions for arrays +// Extra additions to <algorithm> //===----------------------------------------------------------------------===// // We have a copy here so that LLVM behaves the same when using different @@ -1430,12 +1432,6 @@ void shuffle(Iterator first, Iterator last, RNG &&g) { } } -/// Find the length of an array. -template <class T, std::size_t N> -constexpr inline size_t array_lengthof(T (&)[N]) { - return N; -} - /// Adapt std::less<T> for array_pod_sort. template<typename T> inline int array_pod_sort_comparator(const void *P1, const void *P2) { @@ -1563,10 +1559,6 @@ inline void sort(Container &&C, Compare Comp) { llvm::sort(adl_begin(C), adl_end(C), Comp); } -//===----------------------------------------------------------------------===// -// Extra additions to <algorithm> -//===----------------------------------------------------------------------===// - /// Get the size of a range. This is a wrapper function around std::distance /// which is only enabled when the operation is O(1). template <typename R> diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/STLForwardCompat.h b/contrib/llvm-project/llvm/include/llvm/ADT/STLForwardCompat.h index 440b29df260c..0aa577d3ee1a 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/STLForwardCompat.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/STLForwardCompat.h @@ -5,12 +5,13 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file contains library features backported from future STL versions. -// -// These should be replaced with their STL counterparts as the C++ version LLVM -// is compiled with is updated. -// +/// +/// \file +/// This file contains library features backported from future STL versions. +/// +/// These should be replaced with their STL counterparts as the C++ version LLVM +/// is compiled with is updated. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_STLFORWARDCOMPAT_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/ScopeExit.h b/contrib/llvm-project/llvm/include/llvm/ADT/ScopeExit.h index 61618818bae5..7f013f3f7979 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/ScopeExit.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/ScopeExit.h @@ -5,10 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the make_scope_exit function, which executes user-defined -// cleanup logic at scope exit. -// +/// +/// \file +/// This file defines the make_scope_exit function, which executes user-defined +/// cleanup logic at scope exit. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SCOPEEXIT_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SetOperations.h b/contrib/llvm-project/llvm/include/llvm/ADT/SetOperations.h index 3e30b6bb83d3..c9462f077dc8 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SetOperations.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SetOperations.h @@ -5,10 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines generic set operations that may be used on set's of -// different types, and different element types. -// +/// +/// \file +/// This file defines generic set operations that may be used on set's of +/// different types, and different element types. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SETOPERATIONS_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SetVector.h b/contrib/llvm-project/llvm/include/llvm/ADT/SetVector.h index 82d5e98afb5d..08cf42f0b210 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SetVector.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SetVector.h @@ -5,15 +5,16 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file implements a set that has insertion order iteration -// characteristics. This is useful for keeping a set of things that need to be -// visited later but in a deterministic order (insertion order). The interface -// is purposefully minimal. -// -// This file defines SetVector and SmallSetVector, which performs no allocations -// if the SetVector has less than a certain number of elements. -// +/// +/// \file +/// This file implements a set that has insertion order iteration +/// characteristics. This is useful for keeping a set of things that need to be +/// visited later but in a deterministic order (insertion order). The interface +/// is purposefully minimal. +/// +/// This file defines SetVector and SmallSetVector, which performs no +/// allocations if the SetVector has less than a certain number of elements. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SETVECTOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SmallBitVector.h b/contrib/llvm-project/llvm/include/llvm/ADT/SmallBitVector.h index 17be317a10d7..86e304cc6c02 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SmallBitVector.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SmallBitVector.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file implements the SmallBitVector class. -// +/// +/// \file +/// This file implements the SmallBitVector class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SMALLBITVECTOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h index 981b741669b0..ef6dae68b4a6 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the SmallPtrSet class. See the doxygen comment for -// SmallPtrSetImplBase for more details on the algorithm used. +/// +/// \file +/// This file defines the SmallPtrSet class. See the doxygen comment for +/// SmallPtrSetImplBase for more details on the algorithm used. // //===----------------------------------------------------------------------===// diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SmallSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/SmallSet.h index fe4f74eac85d..0eed85449c9d 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SmallSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SmallSet.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the SmallSet class. -// +/// +/// \file +/// This file defines the SmallSet class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SMALLSET_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SmallString.h b/contrib/llvm-project/llvm/include/llvm/ADT/SmallString.h index 81243af1f97d..874968f0a13f 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SmallString.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SmallString.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the SmallString class. -// +/// +/// \file +/// This file defines the SmallString class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SMALLSTRING_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SmallVector.h b/contrib/llvm-project/llvm/include/llvm/ADT/SmallVector.h index 466acb83d466..a4a790323a6b 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SmallVector.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SmallVector.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the SmallVector class. -// +/// +/// /file +/// This file defines the SmallVector class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SMALLVECTOR_H @@ -567,6 +568,16 @@ protected: explicit SmallVectorImpl(unsigned N) : SmallVectorTemplateBase<T>(N) {} + void assignRemote(SmallVectorImpl &&RHS) { + this->destroy_range(this->begin(), this->end()); + if (!this->isSmall()) + free(this->begin()); + this->BeginX = RHS.BeginX; + this->Size = RHS.Size; + this->Capacity = RHS.Capacity; + RHS.resetToSmall(); + } + public: SmallVectorImpl(const SmallVectorImpl &) = delete; @@ -1031,12 +1042,7 @@ SmallVectorImpl<T> &SmallVectorImpl<T>::operator=(SmallVectorImpl<T> &&RHS) { // If the RHS isn't small, clear this vector and then steal its buffer. if (!RHS.isSmall()) { - this->destroy_range(this->begin(), this->end()); - if (!this->isSmall()) free(this->begin()); - this->BeginX = RHS.BeginX; - this->Size = RHS.Size; - this->Capacity = RHS.Capacity; - RHS.resetToSmall(); + this->assignRemote(std::move(RHS)); return *this; } @@ -1227,7 +1233,20 @@ public: } SmallVector &operator=(SmallVector &&RHS) { - SmallVectorImpl<T>::operator=(::std::move(RHS)); + if (N) { + SmallVectorImpl<T>::operator=(::std::move(RHS)); + return *this; + } + // SmallVectorImpl<T>::operator= does not leverage N==0. Optimize the + // case. + if (this == &RHS) + return *this; + if (RHS.empty()) { + this->destroy_range(this->begin(), this->end()); + this->Size = 0; + } else { + this->assignRemote(std::move(RHS)); + } return *this; } diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SparseBitVector.h b/contrib/llvm-project/llvm/include/llvm/ADT/SparseBitVector.h index 12850e14f4ed..a591896521ce 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SparseBitVector.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SparseBitVector.h @@ -5,10 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the SparseBitVector class. See the doxygen comment for -// SparseBitVector for more details on the algorithm used. -// +/// +/// \file +/// This file defines the SparseBitVector class. See the doxygen comment for +/// SparseBitVector for more details on the algorithm used. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SPARSEBITVECTOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SparseMultiSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/SparseMultiSet.h index f63cef936433..ef2a5ea5ed71 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SparseMultiSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SparseMultiSet.h @@ -5,16 +5,17 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the SparseMultiSet class, which adds multiset behavior to -// the SparseSet. -// -// A sparse multiset holds a small number of objects identified by integer keys -// from a moderately sized universe. The sparse multiset uses more memory than -// other containers in order to provide faster operations. Any key can map to -// multiple values. A SparseMultiSetNode class is provided, which serves as a -// convenient base class for the contents of a SparseMultiSet. -// +/// +/// \file +/// This file defines the SparseMultiSet class, which adds multiset behavior to +/// the SparseSet. +/// +/// A sparse multiset holds a small number of objects identified by integer keys +/// from a moderately sized universe. The sparse multiset uses more memory than +/// other containers in order to provide faster operations. Any key can map to +/// multiple values. A SparseMultiSetNode class is provided, which serves as a +/// convenient base class for the contents of a SparseMultiSet. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SPARSEMULTISET_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SparseSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/SparseSet.h index e66d76ad88e1..5c7087b1bffe 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SparseSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SparseSet.h @@ -5,15 +5,16 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the SparseSet class derived from the version described in -// Briggs, Torczon, "An efficient representation for sparse sets", ACM Letters -// on Programming Languages and Systems, Volume 2 Issue 1-4, March-Dec. 1993. -// -// A sparse set holds a small number of objects identified by integer keys from -// a moderately sized universe. The sparse set uses more memory than other -// containers in order to provide faster operations. -// +/// +/// \file +/// This file defines the SparseSet class derived from the version described in +/// Briggs, Torczon, "An efficient representation for sparse sets", ACM Letters +/// on Programming Languages and Systems, Volume 2 Issue 1-4, March-Dec. 1993. +/// +/// A sparse set holds a small number of objects identified by integer keys from +/// a moderately sized universe. The sparse set uses more memory than other +/// containers in order to provide faster operations. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SPARSESET_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Statistic.h b/contrib/llvm-project/llvm/include/llvm/ADT/Statistic.h index 528d2cdcf61b..c39e161bcbcd 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/Statistic.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/Statistic.h @@ -5,21 +5,22 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the 'Statistic' class, which is designed to be an easy way -// to expose various metrics from passes. These statistics are printed at the -// end of a run (from llvm_shutdown), when the -stats command line option is -// passed on the command line. -// -// This is useful for reporting information like the number of instructions -// simplified, optimized or removed by various transformations, like this: -// -// static Statistic NumInstsKilled("gcse", "Number of instructions killed"); -// -// Later, in the code: ++NumInstsKilled; -// -// NOTE: Statistics *must* be declared as global variables. -// +/// +/// \file +/// This file defines the 'Statistic' class, which is designed to be an easy way +/// to expose various metrics from passes. These statistics are printed at the +/// end of a run (from llvm_shutdown), when the -stats command line option is +/// passed on the command line. +/// +/// This is useful for reporting information like the number of instructions +/// simplified, optimized or removed by various transformations, like this: +/// +/// static Statistic NumInstsKilled("gcse", "Number of instructions killed"); +/// +/// Later, in the code: ++NumInstsKilled; +/// +/// NOTE: Statistics *must* be declared as global variables. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_STATISTIC_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/StringExtras.h b/contrib/llvm-project/llvm/include/llvm/ADT/StringExtras.h index 81a0954226d6..ee6c33924e96 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/StringExtras.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/StringExtras.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file contains some functions that are useful when dealing with strings. -// +/// +/// \file +/// This file contains some functions that are useful when dealing with strings. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_STRINGEXTRAS_H @@ -148,13 +149,14 @@ inline char toUpper(char x) { return x; } -inline std::string utohexstr(uint64_t X, bool LowerCase = false) { +inline std::string utohexstr(uint64_t X, bool LowerCase = false, + unsigned Width = 0) { char Buffer[17]; char *BufPtr = std::end(Buffer); if (X == 0) *--BufPtr = '0'; - while (X) { + for (unsigned i = 0; Width ? (i < Width) : X; ++i) { unsigned char Mod = static_cast<unsigned char>(X) & 15; *--BufPtr = hexdigit(Mod, LowerCase); X >>= 4; diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h b/contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h index 562a2ff1a192..23248093c67e 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the StringMap class. -// +/// +/// \file +/// This file defines the StringMap class. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_STRINGMAP_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/StringMapEntry.h b/contrib/llvm-project/llvm/include/llvm/ADT/StringMapEntry.h index 120d4f3ca4bc..6e13c8618c85 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/StringMapEntry.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/StringMapEntry.h @@ -5,11 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the StringMapEntry class - it is intended to be a low -// dependency implementation detail of StringMap that is more suitable for -// inclusion in public headers than StringMap.h itself is. -// +/// +/// \file +/// This file defines the StringMapEntry class - it is intended to be a low +/// dependency implementation detail of StringMap that is more suitable for +/// inclusion in public headers than StringMap.h itself is. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_STRINGMAPENTRY_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/StringSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/StringSet.h index c4245175544b..4a499463d983 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/StringSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/StringSet.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// StringSet - A set-like wrapper for the StringMap. -// +/// +/// \file +/// StringSet - A set-like wrapper for the StringMap. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_STRINGSET_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/StringSwitch.h b/contrib/llvm-project/llvm/include/llvm/ADT/StringSwitch.h index 4b7882d7ca10..95ab1df8d297 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/StringSwitch.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/StringSwitch.h @@ -4,10 +4,11 @@ // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception //===----------------------------------------------------------------------===/ -// -// This file implements the StringSwitch template, which mimics a switch() -// statement whose cases are string literals. -// +/// +/// \file +/// This file implements the StringSwitch template, which mimics a switch() +/// statement whose cases are string literals. +/// //===----------------------------------------------------------------------===/ #ifndef LLVM_ADT_STRINGSWITCH_H #define LLVM_ADT_STRINGSWITCH_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Triple.h b/contrib/llvm-project/llvm/include/llvm/ADT/Triple.h index 0f0a7b08b5d3..42277c013035 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/Triple.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/Triple.h @@ -721,6 +721,41 @@ public: isOSBinFormatELF(); } + /// Tests whether the target is T32. + bool isArmT32() const { + switch (getSubArch()) { + case Triple::ARMSubArch_v8m_baseline: + case Triple::ARMSubArch_v7s: + case Triple::ARMSubArch_v7k: + case Triple::ARMSubArch_v7ve: + case Triple::ARMSubArch_v6: + case Triple::ARMSubArch_v6m: + case Triple::ARMSubArch_v6k: + case Triple::ARMSubArch_v6t2: + case Triple::ARMSubArch_v5: + case Triple::ARMSubArch_v5te: + case Triple::ARMSubArch_v4t: + return false; + default: + return true; + } + } + + /// Tests whether the target is an M-class. + bool isArmMClass() const { + switch (getSubArch()) { + case Triple::ARMSubArch_v6m: + case Triple::ARMSubArch_v7m: + case Triple::ARMSubArch_v7em: + case Triple::ARMSubArch_v8m_mainline: + case Triple::ARMSubArch_v8m_baseline: + case Triple::ARMSubArch_v8_1m_mainline: + return true; + default: + return false; + } + } + /// Tests whether the target is AArch64 (little and big endian). bool isAArch64() const { return getArch() == Triple::aarch64 || getArch() == Triple::aarch64_be || diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/TypeSwitch.h b/contrib/llvm-project/llvm/include/llvm/ADT/TypeSwitch.h index 3b7598f3251d..892a7d43b317 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/TypeSwitch.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/TypeSwitch.h @@ -5,10 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file implements the TypeSwitch template, which mimics a switch() -// statement whose cases are type names. -// +/// +/// \file +/// This file implements the TypeSwitch template, which mimics a switch() +/// statement whose cases are type names. +/// //===-----------------------------------------------------------------------===/ #ifndef LLVM_ADT_TYPESWITCH_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Waymarking.h b/contrib/llvm-project/llvm/include/llvm/ADT/Waymarking.h deleted file mode 100644 index 2efbc6f05495..000000000000 --- a/contrib/llvm-project/llvm/include/llvm/ADT/Waymarking.h +++ /dev/null @@ -1,322 +0,0 @@ -//===- Waymarking.h - Array waymarking algorithm ----------------*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// Utility to backtrace an array's head, from a pointer into it. For the -// backtrace to work, we use "Waymarks", which are special tags embedded into -// the array's elements. -// -// A Tag of n-bits (in size) is composed as follows: -// -// bits: | n-1 | n-2 ... 0 | -// .---------.------------------------------------. -// |Stop Mask|(2^(n-1))-ary numeric system - digit| -// '---------'------------------------------------' -// -// Backtracing is done as follows: -// Walk back (starting from a given pointer to an element into the array), until -// a tag with a "Stop Mask" is reached. Then start calculating the "Offset" from -// the array's head, by picking up digits along the way, until another stop is -// reached. The "Offset" is then subtracted from the current pointer, and the -// result is the array's head. -// A special case - if we first encounter a Tag with a Stop and a zero digit, -// then this is already the head. -// -// For example: -// In case of 2 bits: -// -// Tags: -// x0 - binary digit 0 -// x1 - binary digit 1 -// 1x - stop and calculate (s) -// -// Array: -// .---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---. -// head -> |s0 |s1 | 0 |s1 | 0 | 0 |s1 | 1 | 1 |s1 | 0 | 1 | 0 |s1 | 0 | 1 | -// '---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---' -// |-1 |-2 |-4 |-7 |-10 |-14 -// <_ | | | | | | -// <_____ | | | | | -// <_____________ | | | | -// <_________________________ | | | -// <_____________________________________ | | -// <_____________________________________________________ | -// -// -// In case of 3 bits: -// -// Tags: -// x00 - quaternary digit 0 -// x01 - quaternary digit 1 -// x10 - quaternary digit 2 -// x11 - quaternary digit 3 -// 1xy - stop and calculate (s) -// -// Array: -// .---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---. -// head -> |s0 |s1 |s2 |s3 | 0 |s1 | 2 |s1 | 0 |s2 | 2 |s2 | 0 |s3 | 2 |s3 | -// '---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---' -// |-1 |-2 |-3 |-4 |-6 |-8 |-10 |-12 |-14 |-16 -// <_ | | | | | | | | | | -// <_____ | | | | | | | | | -// <_________ | | | | | | | | -// <_____________ | | | | | | | -// <_____________________ | | | | | | -// <_____________________________ | | | | | -// <_____________________________________ | | | | -// <_____________________________________________ | | | -// <_____________________________________________________ | | -// <_____________________________________________________________ | -// -// -// The API introduce 2 functions: -// 1. fillWaymarks -// 2. followWaymarks -// -// Example: -// int N = 10; -// int M = 5; -// int **A = new int *[N + M]; // Define the array. -// for (int I = 0; I < N + M; ++I) -// A[I] = new int(I); -// -// fillWaymarks(A, A + N); // Set the waymarks for the first N elements -// // of the array. -// // Note that it must be done AFTER we fill -// // the array's elements. -// -// ... // Elements which are not in the range -// // [A, A+N) will not be marked, and we won't -// // be able to call followWaymarks on them. -// -// ... // Elements which will be changed after the -// // call to fillWaymarks, will have to be -// // retagged. -// -// fillWaymarks(A + N, A + N + M, N); // Set the waymarks of the remaining M -// // elements. -// ... -// int **It = A + N + 1; -// int **B = followWaymarks(It); // Find the head of the array containing It. -// assert(B == A); -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_WAYMARKING_H -#define LLVM_ADT_WAYMARKING_H - -#include "llvm/ADT/STLExtras.h" -#include "llvm/Support/PointerLikeTypeTraits.h" - -namespace llvm { - -namespace detail { - -template <unsigned NumBits> struct WaymarkingTraits { - enum : unsigned { - // The number of bits of a Waymarking Tag. - NUM_BITS = NumBits, - - // A Tag is composed from a Mark and a Stop mask. - MARK_SIZE = NUM_BITS - 1, - STOP_MASK = (1 << MARK_SIZE), - MARK_MASK = (STOP_MASK - 1), - TAG_MASK = (MARK_MASK | STOP_MASK), - - // The number of pre-computed tags (for fast fill). - NUM_STATIC_TAGS = 32 - }; - -private: - // Add a new tag, calculated from Count and Stop, to the Vals pack, while - // continuing recursively to decrease Len down to 0. - template <unsigned Len, bool Stop, unsigned Count, uint8_t... Vals> - struct AddTag; - - // Delegate to the specialized AddTag according to the need of a Stop mask. - template <unsigned Len, unsigned Count, uint8_t... Vals> struct GenTag { - typedef - typename AddTag<Len, (Count <= MARK_MASK), Count, Vals...>::Xdata Xdata; - }; - - // Start adding tags while calculating the next Count, which is actually the - // number of already calculated tags (equivalent to the position in the - // array). - template <unsigned Len, uint8_t... Vals> struct GenOffset { - typedef typename GenTag<Len, sizeof...(Vals), Vals...>::Xdata Xdata; - }; - - // Add the tag and remove it from Count. - template <unsigned Len, unsigned Count, uint8_t... Vals> - struct AddTag<Len, false, Count, Vals...> { - typedef typename GenTag<Len - 1, (Count >> MARK_SIZE), Vals..., - Count & MARK_MASK>::Xdata Xdata; - }; - - // We have reached the end of this Count, so start with a new Count. - template <unsigned Len, unsigned Count, uint8_t... Vals> - struct AddTag<Len, true, Count, Vals...> { - typedef typename GenOffset<Len - 1, Vals..., - (Count & MARK_MASK) | STOP_MASK>::Xdata Xdata; - }; - - template <unsigned Count, uint8_t... Vals> struct TagsData { - // The remaining number for calculating the next tag, following the last one - // in Values. - static const unsigned Remain = Count; - - // The array of ordered pre-computed Tags. - static const uint8_t Values[sizeof...(Vals)]; - }; - - // Specialize the case when Len equals 0, as the recursion stop condition. - template <unsigned Count, uint8_t... Vals> - struct AddTag<0, false, Count, Vals...> { - typedef TagsData<Count, Vals...> Xdata; - }; - - template <unsigned Count, uint8_t... Vals> - struct AddTag<0, true, Count, Vals...> { - typedef TagsData<Count, Vals...> Xdata; - }; - -public: - typedef typename GenOffset<NUM_STATIC_TAGS>::Xdata Tags; -}; - -template <unsigned NumBits> -template <unsigned Count, uint8_t... Vals> -const uint8_t WaymarkingTraits<NumBits>::TagsData< - Count, Vals...>::Values[sizeof...(Vals)] = {Vals...}; - -} // end namespace detail - -/// This class is responsible for tagging (and retrieving the tag of) a given -/// element of type T. -template <class T, class WTraits = detail::WaymarkingTraits< - PointerLikeTypeTraits<T>::NumLowBitsAvailable>> -struct Waymarker { - using Traits = WTraits; - static void setWaymark(T &N, unsigned Tag) { N.setWaymark(Tag); } - static unsigned getWaymark(const T &N) { return N.getWaymark(); } -}; - -template <class T, class WTraits> struct Waymarker<T *, WTraits> { - using Traits = WTraits; - static void setWaymark(T *&N, unsigned Tag) { - reinterpret_cast<uintptr_t &>(N) |= static_cast<uintptr_t>(Tag); - } - static unsigned getWaymark(const T *N) { - return static_cast<unsigned>(reinterpret_cast<uintptr_t>(N)) & - Traits::TAG_MASK; - } -}; - -/// Sets up the waymarking algorithm's tags for a given range [Begin, End). -/// -/// \param Begin The beginning of the range to mark with tags (inclusive). -/// \param End The ending of the range to mark with tags (exclusive). -/// \param Offset The position in the supposed tags array from which to start -/// marking the given range. -template <class TIter, class Marker = Waymarker< - typename std::iterator_traits<TIter>::value_type>> -void fillWaymarks(TIter Begin, TIter End, size_t Offset = 0) { - if (Begin == End) - return; - - size_t Count = Marker::Traits::Tags::Remain; - if (Offset <= Marker::Traits::NUM_STATIC_TAGS) { - // Start by filling the pre-calculated tags, starting from the given offset. - while (Offset != Marker::Traits::NUM_STATIC_TAGS) { - Marker::setWaymark(*Begin, Marker::Traits::Tags::Values[Offset]); - - ++Offset; - ++Begin; - - if (Begin == End) - return; - } - } else { - // The given offset is larger than the number of pre-computed tags, so we - // must do it the hard way. - // Calculate the next remaining Count, as if we have filled the tags up to - // the given offset. - size_t Off = Marker::Traits::NUM_STATIC_TAGS; - do { - ++Off; - - // If the count can fit into the tag, then the counting must stop. - if (Count <= Marker::Traits::MARK_MASK) { - Count = Off; - } else - Count >>= Marker::Traits::MARK_SIZE; - } while (Off != Offset); - } - - // By now, we have the matching remaining Count for the current offset. - do { - ++Offset; - - unsigned Tag = Count & Marker::Traits::MARK_MASK; - - // If the count can fit into the tag, then the counting must stop. - if (Count <= Marker::Traits::MARK_MASK) { - Tag |= Marker::Traits::STOP_MASK; - Count = Offset; - } else - Count >>= Marker::Traits::MARK_SIZE; - - Marker::setWaymark(*Begin, Tag); - ++Begin; - } while (Begin != End); -} - -/// Sets up the waymarking algorithm's tags for a given range. -/// -/// \param Range The range to mark with tags. -/// \param Offset The position in the supposed tags array from which to start -/// marking the given range. -template <typename R, class Marker = Waymarker<typename std::remove_reference< - decltype(*std::begin(std::declval<R &>()))>::type>> -void fillWaymarks(R &&Range, size_t Offset = 0) { - return fillWaymarks<decltype(std::begin(std::declval<R &>())), Marker>( - adl_begin(Range), adl_end(Range), Offset); -} - -/// Retrieves the element marked with tag of only STOP_MASK, by following the -/// waymarks. This is the first element in a range passed to a previous call to -/// \c fillWaymarks with \c Offset 0. -/// -/// For the trivial usage of calling \c fillWaymarks(Array), and \I is an -/// iterator inside \c Array, this function retrieves the head of \c Array, by -/// following the waymarks. -/// -/// \param I The iterator into an array which was marked by the waymarking tags -/// (by a previous call to \c fillWaymarks). -template <class TIter, class Marker = Waymarker< - typename std::iterator_traits<TIter>::value_type>> -TIter followWaymarks(TIter I) { - unsigned Tag; - do - Tag = Marker::getWaymark(*I--); - while (!(Tag & Marker::Traits::STOP_MASK)); - - // Special case for the first Use. - if (Tag != Marker::Traits::STOP_MASK) { - ptrdiff_t Offset = Tag & Marker::Traits::MARK_MASK; - while (!((Tag = Marker::getWaymark(*I)) & Marker::Traits::STOP_MASK)) { - Offset = (Offset << Marker::Traits::MARK_SIZE) + Tag; - --I; - } - I -= Offset; - } - return ++I; -} - -} // end namespace llvm - -#endif // LLVM_ADT_WAYMARKING_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/bit.h b/contrib/llvm-project/llvm/include/llvm/ADT/bit.h index d76bc6c6046c..49b27c89e5fe 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/bit.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/bit.h @@ -5,9 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file implements the C++20 <bit> header. -// +/// +/// \file +/// This file implements the C++20 <bit> header. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_BIT_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/edit_distance.h b/contrib/llvm-project/llvm/include/llvm/ADT/edit_distance.h index 4f5134008692..c480c1e7cd78 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/edit_distance.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/edit_distance.h @@ -5,11 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines a Levenshtein distance function that works for any two -// sequences, with each element of each sequence being analogous to a character -// in a string. -// +/// +/// \file +/// This file defines a Levenshtein distance function that works for any two +/// sequences, with each element of each sequence being analogous to a character +/// in a string. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_EDIT_DISTANCE_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/ilist.h b/contrib/llvm-project/llvm/include/llvm/ADT/ilist.h index b3aa26f2454d..9913b7cccbdd 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/ilist.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/ilist.h @@ -5,19 +5,20 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines classes to implement an intrusive doubly linked list class -// (i.e. each node of the list must contain a next and previous field for the -// list. -// -// The ilist class itself should be a plug in replacement for list. This list -// replacement does not provide a constant time size() method, so be careful to -// use empty() when you really want to know if it's empty. -// -// The ilist class is implemented as a circular list. The list itself contains -// a sentinel node, whose Next points at begin() and whose Prev points at -// rbegin(). The sentinel node itself serves as end() and rend(). -// +/// +/// \file +/// This file defines classes to implement an intrusive doubly linked list class +/// (i.e. each node of the list must contain a next and previous field for the +/// list. +/// +/// The ilist class itself should be a plug in replacement for list. This list +/// replacement does not provide a constant time size() method, so be careful to +/// use empty() when you really want to know if it's empty. +/// +/// The ilist class is implemented as a circular list. The list itself contains +/// a sentinel node, whose Next points at begin() and whose Prev points at +/// rbegin(). The sentinel node itself serves as end() and rend(). +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_ILIST_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/ilist_node.h b/contrib/llvm-project/llvm/include/llvm/ADT/ilist_node.h index e040d9630a1e..7856b1c0d410 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/ilist_node.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/ilist_node.h @@ -5,10 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// This file defines the ilist_node class template, which is a convenient -// base class for creating classes that can be used with ilists. -// +/// +/// \file +/// This file defines the ilist_node class template, which is a convenient +/// base class for creating classes that can be used with ilists. +/// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_ILIST_NODE_H diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h b/contrib/llvm-project/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h index 043b1b7ca2dc..2dd2e7ca916d 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h @@ -26,6 +26,7 @@ #include "llvm/IR/Function.h" #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { class AAResults; diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/CycleAnalysis.h b/contrib/llvm-project/llvm/include/llvm/Analysis/CycleAnalysis.h index e16b908d6a10..539d29eb5e9c 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/CycleAnalysis.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/CycleAnalysis.h @@ -18,6 +18,7 @@ #include "llvm/ADT/GenericCycleInfo.h" #include "llvm/IR/PassManager.h" #include "llvm/IR/SSAContext.h" +#include "llvm/Pass.h" namespace llvm { extern template class GenericCycleInfo<SSAContext>; diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/DDG.h b/contrib/llvm-project/llvm/include/llvm/Analysis/DDG.h index 4ea589ec7efc..c5107da2a017 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/DDG.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/DDG.h @@ -53,7 +53,7 @@ public: DDGNode() = delete; DDGNode(const NodeKind K) : Kind(K) {} - DDGNode(const DDGNode &N) : DDGNodeBase(N), Kind(N.Kind) {} + DDGNode(const DDGNode &N) = default; DDGNode(DDGNode &&N) : DDGNodeBase(std::move(N)), Kind(N.Kind) {} virtual ~DDGNode() = 0; @@ -93,7 +93,7 @@ public: RootDDGNode() : DDGNode(NodeKind::Root) {} RootDDGNode(const RootDDGNode &N) = delete; RootDDGNode(RootDDGNode &&N) : DDGNode(std::move(N)) {} - ~RootDDGNode() {} + ~RootDDGNode() = default; /// Define classof to be able to use isa<>, cast<>, dyn_cast<>, etc. static bool classof(const DDGNode *N) { @@ -113,11 +113,7 @@ public: SimpleDDGNode(SimpleDDGNode &&N); ~SimpleDDGNode(); - SimpleDDGNode &operator=(const SimpleDDGNode &N) { - DDGNode::operator=(N); - InstList = N.InstList; - return *this; - } + SimpleDDGNode &operator=(const SimpleDDGNode &N) = default; SimpleDDGNode &operator=(SimpleDDGNode &&N) { DDGNode::operator=(std::move(N)); @@ -179,11 +175,7 @@ public: PiBlockDDGNode(PiBlockDDGNode &&N); ~PiBlockDDGNode(); - PiBlockDDGNode &operator=(const PiBlockDDGNode &N) { - DDGNode::operator=(N); - NodeList = N.NodeList; - return *this; - } + PiBlockDDGNode &operator=(const PiBlockDDGNode &N) = default; PiBlockDDGNode &operator=(PiBlockDDGNode &&N) { DDGNode::operator=(std::move(N)); @@ -231,11 +223,7 @@ public: DDGEdge(DDGNode &N, EdgeKind K) : DDGEdgeBase(N), Kind(K) {} DDGEdge(const DDGEdge &E) : DDGEdgeBase(E), Kind(E.getKind()) {} DDGEdge(DDGEdge &&E) : DDGEdgeBase(std::move(E)), Kind(E.Kind) {} - DDGEdge &operator=(const DDGEdge &E) { - DDGEdgeBase::operator=(E); - Kind = E.Kind; - return *this; - } + DDGEdge &operator=(const DDGEdge &E) = default; DDGEdge &operator=(DDGEdge &&E) { DDGEdgeBase::operator=(std::move(E)); @@ -272,7 +260,7 @@ public: : Name(N), DI(DepInfo), Root(nullptr) {} DependenceGraphInfo(DependenceGraphInfo &&G) : Name(std::move(G.Name)), DI(std::move(G.DI)), Root(G.Root) {} - virtual ~DependenceGraphInfo() {} + virtual ~DependenceGraphInfo() = default; /// Return the label that is used to name this graph. StringRef getName() const { return Name; } diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/DependenceAnalysis.h b/contrib/llvm-project/llvm/include/llvm/Analysis/DependenceAnalysis.h index 8c852e85b04a..638f4869d677 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/DependenceAnalysis.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/DependenceAnalysis.h @@ -76,7 +76,7 @@ namespace llvm { public: Dependence(Instruction *Source, Instruction *Destination) : Src(Source), Dst(Destination) {} - virtual ~Dependence() {} + virtual ~Dependence() = default; /// Dependence::DVEntry - Each level in the distance/direction vector /// has a direction (or perhaps a union of several directions), and diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/DependenceGraphBuilder.h b/contrib/llvm-project/llvm/include/llvm/Analysis/DependenceGraphBuilder.h index 332829cbc8a9..e0dbdcdaa749 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/DependenceGraphBuilder.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/DependenceGraphBuilder.h @@ -43,7 +43,7 @@ public: AbstractDependenceGraphBuilder(GraphType &G, DependenceInfo &D, const BasicBlockListType &BBs) : Graph(G), DI(D), BBList(BBs) {} - virtual ~AbstractDependenceGraphBuilder() {} + virtual ~AbstractDependenceGraphBuilder() = default; /// The main entry to the graph construction algorithm. It starts by /// creating nodes in increasing order of granularity and then diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h b/contrib/llvm-project/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h index 7b81d5754930..90ab2833e428 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h @@ -262,7 +262,20 @@ struct IRInstructionData llvm::hash_value(ID.Inst->getType()), llvm::hash_value(ID.getPredicate()), llvm::hash_combine_range(OperTypes.begin(), OperTypes.end())); - else if (isa<CallInst>(ID.Inst)) { + + if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(ID.Inst)) { + // To hash intrinsics, we use the opcode, and types like the other + // instructions, but also, the Intrinsic ID, and the Name of the + // intrinsic. + Intrinsic::ID IntrinsicID = II->getIntrinsicID(); + return llvm::hash_combine( + llvm::hash_value(ID.Inst->getOpcode()), + llvm::hash_value(ID.Inst->getType()), llvm::hash_value(IntrinsicID), + llvm::hash_value(*ID.CalleeName), + llvm::hash_combine_range(OperTypes.begin(), OperTypes.end())); + } + + if (isa<CallInst>(ID.Inst)) { std::string FunctionName = *ID.CalleeName; return llvm::hash_combine( llvm::hash_value(ID.Inst->getOpcode()), @@ -270,6 +283,7 @@ struct IRInstructionData llvm::hash_value(ID.Inst->getType()), llvm::hash_value(FunctionName), llvm::hash_combine_range(OperTypes.begin(), OperTypes.end())); } + return llvm::hash_combine( llvm::hash_value(ID.Inst->getOpcode()), llvm::hash_value(ID.Inst->getType()), @@ -499,7 +513,7 @@ struct IRInstructionMapper { /// be analyzed for similarity. struct InstructionClassification : public InstVisitor<InstructionClassification, InstrType> { - InstructionClassification() {} + InstructionClassification() = default; // TODO: Determine a scheme to resolve when the label is similar enough. InstrType visitBranchInst(BranchInst &BI) { @@ -525,8 +539,17 @@ struct IRInstructionMapper { // analyzed for similarity as it has no bearing on the outcome of the // program. InstrType visitDbgInfoIntrinsic(DbgInfoIntrinsic &DII) { return Invisible; } - // TODO: Handle specific intrinsics. - InstrType visitIntrinsicInst(IntrinsicInst &II) { return Illegal; } + InstrType visitIntrinsicInst(IntrinsicInst &II) { + // These are disabled due to complications in the CodeExtractor when + // outlining these instructions. For instance, It is unclear what we + // should do when moving only the start or end lifetime instruction into + // an outlined function. Also, assume-like intrinsics could be removed + // from the region, removing arguments, causing discrepencies in the + // number of inputs between different regions. + if (II.isLifetimeStartOrEnd() || II.isAssumeLikeIntrinsic()) + return Illegal; + return EnableIntrinsics ? Legal : Illegal; + } // We only allow call instructions where the function has a name and // is not an indirect call. InstrType visitCallInst(CallInst &CI) { @@ -553,6 +576,10 @@ struct IRInstructionMapper { // The flag variable that lets the classifier know whether we should // allow indirect calls to be considered legal instructions. bool EnableIndirectCalls = false; + + // Flag that lets the classifier know whether we should allow intrinsics to + // be checked for similarity. + bool EnableIntrinsics = false; }; /// Maps an Instruction to a member of InstrType. @@ -939,10 +966,12 @@ class IRSimilarityIdentifier { public: IRSimilarityIdentifier(bool MatchBranches = true, bool MatchIndirectCalls = true, - bool MatchCallsWithName = false) + bool MatchCallsWithName = false, + bool MatchIntrinsics = true) : Mapper(&InstDataAllocator, &InstDataListAllocator), EnableBranches(MatchBranches), EnableIndirectCalls(MatchIndirectCalls), - EnableMatchingCallsByName(MatchCallsWithName) {} + EnableMatchingCallsByName(MatchCallsWithName), + EnableIntrinsics(MatchIntrinsics) {} private: /// Map the instructions in the module to unsigned integers, using mapping @@ -1031,6 +1060,10 @@ private: /// convention, attributes and type signature. bool EnableMatchingCallsByName = true; + /// The flag variable that marks whether we should check intrinsics for + /// similarity. + bool EnableIntrinsics = true; + /// The SimilarityGroups found with the most recent run of \ref /// findSimilarity. None if there is no recent run. Optional<SimilarityGroupList> SimilarityCandidates; diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/IndirectCallVisitor.h b/contrib/llvm-project/llvm/include/llvm/Analysis/IndirectCallVisitor.h index eb72f2c5d14d..0825e19ecd2d 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/IndirectCallVisitor.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/IndirectCallVisitor.h @@ -19,7 +19,7 @@ namespace llvm { // Visitor class that finds all indirect call. struct PGOIndirectCallVisitor : public InstVisitor<PGOIndirectCallVisitor> { std::vector<CallBase *> IndirectCalls; - PGOIndirectCallVisitor() {} + PGOIndirectCallVisitor() = default; void visitCallBase(CallBase &Call) { if (Call.isIndirectCall()) diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/InlineOrder.h b/contrib/llvm-project/llvm/include/llvm/Analysis/InlineOrder.h index feefa9b9ddd1..84252bcf1b06 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/InlineOrder.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/InlineOrder.h @@ -26,7 +26,7 @@ public: using reference = T &; using const_reference = const T &; - virtual ~InlineOrder() {} + virtual ~InlineOrder() = default; virtual size_t size() = 0; diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/LazyCallGraph.h b/contrib/llvm-project/llvm/include/llvm/Analysis/LazyCallGraph.h index eb8f66bada59..c0404d37d04d 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/LazyCallGraph.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/LazyCallGraph.h @@ -1203,7 +1203,7 @@ private: } }; -inline LazyCallGraph::Edge::Edge() {} +inline LazyCallGraph::Edge::Edge() = default; inline LazyCallGraph::Edge::Edge(Node &N, Kind K) : Value(&N, K) {} inline LazyCallGraph::Edge::operator bool() const { diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h index 57f732cc854b..754391e10630 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h @@ -38,7 +38,7 @@ class LazyValueInfo { void operator=(const LazyValueInfo&) = delete; public: ~LazyValueInfo(); - LazyValueInfo() {} + LazyValueInfo() = default; LazyValueInfo(AssumptionCache *AC_, const DataLayout *DL_, TargetLibraryInfo *TLI_) : AC(AC_), DL(DL_), TLI(TLI_) {} diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/Loads.h b/contrib/llvm-project/llvm/include/llvm/Analysis/Loads.h index 3db501c51a17..09bf98d324ed 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/Loads.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/Loads.h @@ -42,8 +42,7 @@ bool isDereferenceablePointer(const Value *V, Type *Ty, /// performs context-sensitive analysis and returns true if the pointer is /// dereferenceable at the specified instruction. bool isDereferenceableAndAlignedPointer(const Value *V, Type *Ty, - MaybeAlign Alignment, - const DataLayout &DL, + Align Alignment, const DataLayout &DL, const Instruction *CtxI = nullptr, const DominatorTree *DT = nullptr, const TargetLibraryInfo *TLI = nullptr); diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/LoopInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/LoopInfo.h index b2326c4714dd..a0ffdb07a7ec 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/LoopInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/LoopInfo.h @@ -535,7 +535,7 @@ public: DebugLoc End; public: - LocRange() {} + LocRange() = default; LocRange(DebugLoc Start) : Start(Start), End(Start) {} LocRange(DebugLoc Start, DebugLoc End) : Start(std::move(Start)), End(std::move(End)) {} @@ -900,7 +900,7 @@ template <class BlockT, class LoopT> class LoopInfoBase { LoopInfoBase(const LoopInfoBase &) = delete; public: - LoopInfoBase() {} + LoopInfoBase() = default; ~LoopInfoBase() { releaseMemory(); } LoopInfoBase(LoopInfoBase &&Arg) @@ -1092,7 +1092,7 @@ class LoopInfo : public LoopInfoBase<BasicBlock, Loop> { LoopInfo(const LoopInfo &) = delete; public: - LoopInfo() {} + LoopInfo() = default; explicit LoopInfo(const DominatorTreeBase<BasicBlock, false> &DomTree); LoopInfo(LoopInfo &&Arg) : BaseT(std::move(static_cast<BaseT &>(Arg))) {} @@ -1336,6 +1336,10 @@ bool hasMustProgress(const Loop *L); /// be infinite without side effects without also being undefined) bool isMustProgress(const Loop *L); +/// Return true if this loop can be assumed to run for a finite number of +/// iterations. +bool isFinite(const Loop *L); + /// Return whether an MDNode might represent an access group. /// /// Access group metadata nodes have to be distinct and empty. Being diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/MLInlineAdvisor.h b/contrib/llvm-project/llvm/include/llvm/Analysis/MLInlineAdvisor.h index 05411d9c99a2..b1a81d5e7030 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/MLInlineAdvisor.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/MLInlineAdvisor.h @@ -15,6 +15,7 @@ #include "llvm/IR/PassManager.h" #include <deque> +#include <map> #include <memory> namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h b/contrib/llvm-project/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h index cb522cf731d3..feb22c250979 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h @@ -23,6 +23,7 @@ #include "llvm/IR/PassManager.h" #include "llvm/IR/PredIteratorCache.h" #include "llvm/IR/ValueHandle.h" +#include "llvm/Pass.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/MustExecute.h b/contrib/llvm-project/llvm/include/llvm/Analysis/MustExecute.h index df489aaa534d..18a0bfee5730 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/MustExecute.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/MustExecute.h @@ -281,9 +281,7 @@ struct MustBeExecutedIterator { using ExplorerTy = MustBeExecutedContextExplorer; - MustBeExecutedIterator(const MustBeExecutedIterator &Other) - : Visited(Other.Visited), Explorer(Other.Explorer), - CurInst(Other.CurInst), Head(Other.Head), Tail(Other.Tail) {} + MustBeExecutedIterator(const MustBeExecutedIterator &Other) = default; MustBeExecutedIterator(MustBeExecutedIterator &&Other) : Visited(std::move(Other.Visited)), Explorer(Other.Explorer), @@ -299,7 +297,7 @@ struct MustBeExecutedIterator { return *this; } - ~MustBeExecutedIterator() {} + ~MustBeExecutedIterator() = default; /// Pre- and post-increment operators. ///{ diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/ObjCARCUtil.h b/contrib/llvm-project/llvm/include/llvm/Analysis/ObjCARCUtil.h index 1d330ca58a87..385fa5422926 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/ObjCARCUtil.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/ObjCARCUtil.h @@ -42,7 +42,7 @@ inline bool hasAttachedCallOpBundle(const CallBase *CB) { /// which is the address of the ARC runtime function. inline Optional<Function *> getAttachedARCFunction(const CallBase *CB) { auto B = CB->getOperandBundle(LLVMContext::OB_clang_arc_attachedcall); - if (!B.hasValue() || B->Inputs.size() == 0) + if (!B) return None; return cast<Function>(B->Inputs[0]); diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/ScalarEvolution.h b/contrib/llvm-project/llvm/include/llvm/Analysis/ScalarEvolution.h index 1e6dac44cf2b..b16aa7017719 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/ScalarEvolution.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/ScalarEvolution.h @@ -1111,9 +1111,11 @@ public: /// Simplify LHS and RHS in a comparison with predicate Pred. Return true /// iff any changes were made. If the operands are provably equal or /// unequal, LHS and RHS are set to the same value and Pred is set to either - /// ICMP_EQ or ICMP_NE. + /// ICMP_EQ or ICMP_NE. ControllingFiniteLoop is set if this comparison + /// controls the exit of a loop known to have a finite number of iterations. bool SimplifyICmpOperands(ICmpInst::Predicate &Pred, const SCEV *&LHS, - const SCEV *&RHS, unsigned Depth = 0); + const SCEV *&RHS, unsigned Depth = 0, + bool ControllingFiniteLoop = false); /// Return the "disposition" of the given SCEV with respect to the given /// loop. diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/SparsePropagation.h b/contrib/llvm-project/llvm/include/llvm/Analysis/SparsePropagation.h index 27c58c0afa8a..6eb6d5518a41 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/SparsePropagation.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/SparsePropagation.h @@ -14,6 +14,7 @@ #ifndef LLVM_ANALYSIS_SPARSEPROPAGATION_H #define LLVM_ANALYSIS_SPARSEPROPAGATION_H +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/IR/Instructions.h" #include "llvm/Support/Debug.h" #include <set> diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h index 6e3e1380535e..17d1e3f770c1 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h @@ -254,15 +254,10 @@ public: } // Provide value semantics. - TargetLibraryInfo(const TargetLibraryInfo &TLI) - : Impl(TLI.Impl), OverrideAsUnavailable(TLI.OverrideAsUnavailable) {} + TargetLibraryInfo(const TargetLibraryInfo &TLI) = default; TargetLibraryInfo(TargetLibraryInfo &&TLI) : Impl(TLI.Impl), OverrideAsUnavailable(TLI.OverrideAsUnavailable) {} - TargetLibraryInfo &operator=(const TargetLibraryInfo &TLI) { - Impl = TLI.Impl; - OverrideAsUnavailable = TLI.OverrideAsUnavailable; - return *this; - } + TargetLibraryInfo &operator=(const TargetLibraryInfo &TLI) = default; TargetLibraryInfo &operator=(TargetLibraryInfo &&TLI) { Impl = TLI.Impl; OverrideAsUnavailable = TLI.OverrideAsUnavailable; @@ -445,7 +440,7 @@ public: /// /// This will use the module's triple to construct the library info for that /// module. - TargetLibraryAnalysis() {} + TargetLibraryAnalysis() = default; /// Construct a library analysis with baseline Module-level info. /// diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h index 34ef9cc61c4f..7412e050322e 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -1789,7 +1789,7 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept { public: Model(T Impl) : Impl(std::move(Impl)) {} - ~Model() override {} + ~Model() override = default; const DataLayout &getDataLayout() const override { return Impl.getDataLayout(); diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h index 4b9ef7c57ffc..a32744f8d58b 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -42,8 +42,7 @@ protected: public: // Provide value semantics. MSVC requires that we spell all of these out. - TargetTransformInfoImplBase(const TargetTransformInfoImplBase &Arg) - : DL(Arg.DL) {} + TargetTransformInfoImplBase(const TargetTransformInfoImplBase &Arg) = default; TargetTransformInfoImplBase(TargetTransformInfoImplBase &&Arg) : DL(Arg.DL) {} const DataLayout &getDataLayout() const { return DL; } diff --git a/contrib/llvm-project/llvm/include/llvm/BinaryFormat/ELF.h b/contrib/llvm-project/llvm/include/llvm/BinaryFormat/ELF.h index 8840929174d6..5d3b1270b538 100644 --- a/contrib/llvm-project/llvm/include/llvm/BinaryFormat/ELF.h +++ b/contrib/llvm-project/llvm/include/llvm/BinaryFormat/ELF.h @@ -372,7 +372,8 @@ enum { // was never defined for V1. ELFABIVERSION_AMDGPU_HSA_V2 = 0, ELFABIVERSION_AMDGPU_HSA_V3 = 1, - ELFABIVERSION_AMDGPU_HSA_V4 = 2 + ELFABIVERSION_AMDGPU_HSA_V4 = 2, + ELFABIVERSION_AMDGPU_HSA_V5 = 3 }; #define ELF_RELOC(name, value) name = value, diff --git a/contrib/llvm-project/llvm/include/llvm/BinaryFormat/MsgPackDocument.h b/contrib/llvm-project/llvm/include/llvm/BinaryFormat/MsgPackDocument.h index 6d7aca89ee5b..448c7a4e0034 100644 --- a/contrib/llvm-project/llvm/include/llvm/BinaryFormat/MsgPackDocument.h +++ b/contrib/llvm-project/llvm/include/llvm/BinaryFormat/MsgPackDocument.h @@ -218,7 +218,7 @@ private: /// A DocNode that is a map. class MapDocNode : public DocNode { public: - MapDocNode() {} + MapDocNode() = default; MapDocNode(DocNode &N) : DocNode(N) { assert(getKind() == Type::Map); } // Map access methods. @@ -248,7 +248,7 @@ public: /// A DocNode that is an array. class ArrayDocNode : public DocNode { public: - ArrayDocNode() {} + ArrayDocNode() = default; ArrayDocNode(DocNode &N) : DocNode(N) { assert(getKind() == Type::Array); } // Array access methods. diff --git a/contrib/llvm-project/llvm/include/llvm/BinaryFormat/Swift.def b/contrib/llvm-project/llvm/include/llvm/BinaryFormat/Swift.def new file mode 100644 index 000000000000..6160e2551432 --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm/BinaryFormat/Swift.def @@ -0,0 +1,26 @@ +//===- llvm/BinaryFormat/Swift.def - Swift definitions ---------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Macros for running through Swift enumerators. +// +//===----------------------------------------------------------------------===// + +#if !(defined HANDLE_SWIFT_SECTION) +#error "Missing macro definition of HANDLE_SWIFT_SECTION" +#endif + +#ifndef HANDLE_SWIFT_SECTION +#define HANDLE_SWIFT_SECTION(KIND, MACHO, ELF, COFF) +#endif + +HANDLE_SWIFT_SECTION(fieldmd, "__swift5_fieldmd", "swift5_fieldmd", ".sw5flmd") +HANDLE_SWIFT_SECTION(assocty, "__swift5_assocty", "swift5_assocty", ".sw5asty") +HANDLE_SWIFT_SECTION(builtin, "__swift5_builtin", "swift5_builtin", ".sw5bltn") +HANDLE_SWIFT_SECTION(capture, "__swift5_capture", "swift5_capture", ".sw5cptr") +HANDLE_SWIFT_SECTION(typeref, "__swift5_typeref", "swift5_typeref", ".sw5tyrf") +HANDLE_SWIFT_SECTION(reflstr, "__swift5_reflstr", "swift5_reflstr", ".sw5rfst") diff --git a/contrib/llvm-project/llvm/include/llvm/BinaryFormat/Swift.h b/contrib/llvm-project/llvm/include/llvm/BinaryFormat/Swift.h new file mode 100644 index 000000000000..68c04f11196e --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm/BinaryFormat/Swift.h @@ -0,0 +1,24 @@ +//===-- llvm/BinaryFormat/Swift.h ---Swift Constants-------------*- C++ -*-===// +// +// 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_BINARYFORMAT_SWIFT_H +#define LLVM_BINARYFORMAT_SWIFT_H + +namespace llvm { +namespace binaryformat { + +enum Swift5ReflectionSectionKind { +#define HANDLE_SWIFT_SECTION(KIND, MACHO, ELF, COFF) KIND, +#include "llvm/BinaryFormat/Swift.def" +#undef HANDLE_SWIFT_SECTION + unknown, + last = unknown +}; +} // end of namespace binaryformat +} // end of namespace llvm + +#endif diff --git a/contrib/llvm-project/llvm/include/llvm/Bitcode/BitcodeWriter.h b/contrib/llvm-project/llvm/include/llvm/Bitcode/BitcodeWriter.h index 7ad2d37a2a35..96f25fce8ddb 100644 --- a/contrib/llvm-project/llvm/include/llvm/Bitcode/BitcodeWriter.h +++ b/contrib/llvm-project/llvm/include/llvm/Bitcode/BitcodeWriter.h @@ -139,7 +139,7 @@ class raw_ostream; /// /// ModHash is for use in ThinLTO incremental build, generated while the IR /// bitcode file writing. - void WriteThinLinkBitcodeToFile(const Module &M, raw_ostream &Out, + void writeThinLinkBitcodeToFile(const Module &M, raw_ostream &Out, const ModuleSummaryIndex &Index, const ModuleHash &ModHash); @@ -148,7 +148,7 @@ class raw_ostream; /// writing the combined index file for ThinLTO. When writing a subset of the /// index for a distributed backend, provide the \p ModuleToSummariesForIndex /// map. - void WriteIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out, + void writeIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out, const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex = nullptr); @@ -161,7 +161,7 @@ class raw_ostream; /// If EmbedCmdline is set, the command line is also exported in /// the corresponding section (__LLVM,_cmdline / .llvmcmd) - even if CmdArgs /// were empty. - void EmbedBitcodeInModule(Module &M, MemoryBufferRef Buf, bool EmbedBitcode, + void embedBitcodeInModule(Module &M, MemoryBufferRef Buf, bool EmbedBitcode, bool EmbedCmdline, const std::vector<uint8_t> &CmdArgs); diff --git a/contrib/llvm-project/llvm/include/llvm/Bitstream/BitstreamReader.h b/contrib/llvm-project/llvm/include/llvm/Bitstream/BitstreamReader.h index 0393d1a51866..37b7c4d73cff 100644 --- a/contrib/llvm-project/llvm/include/llvm/Bitstream/BitstreamReader.h +++ b/contrib/llvm-project/llvm/include/llvm/Bitstream/BitstreamReader.h @@ -20,8 +20,7 @@ #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" #include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/MathExtras.h" -#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/MemoryBufferRef.h" #include <algorithm> #include <cassert> #include <climits> diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/DIE.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/DIE.h index 32df448b91a1..7f7372630dbe 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/DIE.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/DIE.h @@ -886,8 +886,8 @@ class DIEUnit { DIE Die; /// The section this unit will be emitted in. This may or may not be set to /// a valid section depending on the client that is emitting DWARF. - MCSection *Section; - uint64_t Offset; /// .debug_info or .debug_types absolute section offset. + MCSection *Section = nullptr; + uint64_t Offset = 0; /// .debug_info or .debug_types absolute section offset. protected: virtual ~DIEUnit() = default; diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/FastISel.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/FastISel.h index 9c7e688da6a7..775698a66ada 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/FastISel.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/FastISel.h @@ -217,12 +217,12 @@ protected: /// for use in the current block. It resets to EmitStartPt when it makes sense /// (for example, it's usually profitable to avoid function calls between the /// definition and the use) - MachineInstr *LastLocalValue; + MachineInstr *LastLocalValue = nullptr; /// The top most instruction in the current block that is allowed for /// emitting local variables. LastLocalValue resets to EmitStartPt when it /// makes sense (for example, on function calls) - MachineInstr *EmitStartPt; + MachineInstr *EmitStartPt = nullptr; public: virtual ~FastISel(); diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h index 3a4b3ee18e1b..f9663fadb868 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h @@ -95,7 +95,7 @@ public: bool IsFixed = true) : ArgInfo(Regs, OrigValue.getType(), OrigIndex, Flags, IsFixed, &OrigValue) {} - ArgInfo() {} + ArgInfo() = default; }; struct CallLoweringInfo { diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/GISelChangeObserver.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/GISelChangeObserver.h index 79d71b2c8982..70945fcecfe5 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/GISelChangeObserver.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/GISelChangeObserver.h @@ -30,7 +30,7 @@ class GISelChangeObserver { SmallPtrSet<MachineInstr *, 4> ChangingAllUsesOfReg; public: - virtual ~GISelChangeObserver() {} + virtual ~GISelChangeObserver() = default; /// An instruction is about to be erased. virtual void erasingInstr(MachineInstr &MI) = 0; diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h index f6704df3f49d..3cacdc99dbf8 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h @@ -465,7 +465,7 @@ private: ScalarSizeChangeStrategies[LastOp - FirstOp + 1]; SmallVector<SizeChangeStrategy, 1> VectorElementSizeChangeStrategies[LastOp - FirstOp + 1]; - bool TablesInitialized; + bool TablesInitialized = false; // Data structures used by getAction: SmallVector<SizeAndActionsVec, 1> ScalarActions[LastOp - FirstOp + 1]; diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h index 9507c3411b5c..17cb53dd2d5b 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h @@ -403,9 +403,9 @@ public: class LegalizeRuleSet { /// When non-zero, the opcode we are an alias of - unsigned AliasOf; + unsigned AliasOf = 0; /// If true, there is another opcode that aliases this one - bool IsAliasedByAnother; + bool IsAliasedByAnother = false; SmallVector<LegalizeRule, 2> Rules; #ifndef NDEBUG @@ -432,16 +432,6 @@ class LegalizeRuleSet { return TypeIdx; } - unsigned immIdx(unsigned ImmIdx) { - assert(ImmIdx <= (MCOI::OPERAND_LAST_GENERIC_IMM - - MCOI::OPERAND_FIRST_GENERIC_IMM) && - "Imm Index is out of bounds"); -#ifndef NDEBUG - ImmIdxsCovered.set(ImmIdx); -#endif - return ImmIdx; - } - void markAllIdxsAsCovered() { #ifndef NDEBUG TypeIdxsCovered.set(); @@ -556,7 +546,7 @@ class LegalizeRuleSet { } public: - LegalizeRuleSet() : AliasOf(0), IsAliasedByAnother(false) {} + LegalizeRuleSet() = default; bool isAliasedByAnother() { return IsAliasedByAnother; } void setIsAliasedByAnother() { IsAliasedByAnother = true; } @@ -568,6 +558,16 @@ public: } unsigned getAlias() const { return AliasOf; } + unsigned immIdx(unsigned ImmIdx) { + assert(ImmIdx <= (MCOI::OPERAND_LAST_GENERIC_IMM - + MCOI::OPERAND_FIRST_GENERIC_IMM) && + "Imm Index is out of bounds"); +#ifndef NDEBUG + ImmIdxsCovered.set(ImmIdx); +#endif + return ImmIdx; + } + /// The instruction is legal if predicate is true. LegalizeRuleSet &legalIf(LegalityPredicate Predicate) { // We have no choice but conservatively assume that the free-form @@ -824,11 +824,22 @@ public: LegalizeRuleSet &customForCartesianProduct(std::initializer_list<LLT> Types) { return actionForCartesianProduct(LegalizeAction::Custom, Types); } + /// The instruction is custom when type indexes 0 and 1 are both in their + /// respective lists. LegalizeRuleSet & customForCartesianProduct(std::initializer_list<LLT> Types0, std::initializer_list<LLT> Types1) { return actionForCartesianProduct(LegalizeAction::Custom, Types0, Types1); } + /// The instruction is custom when when type indexes 0, 1, and 2 are all in + /// their respective lists. + LegalizeRuleSet & + customForCartesianProduct(std::initializer_list<LLT> Types0, + std::initializer_list<LLT> Types1, + std::initializer_list<LLT> Types2) { + return actionForCartesianProduct(LegalizeAction::Custom, Types0, Types1, + Types2); + } /// Unconditionally custom lower. LegalizeRuleSet &custom() { diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/IntrinsicLowering.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/IntrinsicLowering.h index 8593f54f3961..06512f2dc560 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/IntrinsicLowering.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/IntrinsicLowering.h @@ -24,10 +24,10 @@ class DataLayout; class IntrinsicLowering { const DataLayout &DL; - bool Warned; + bool Warned = false; public: - explicit IntrinsicLowering(const DataLayout &DL) : DL(DL), Warned(false) {} + explicit IntrinsicLowering(const DataLayout &DL) : DL(DL) {} /// Replace a call to the specified intrinsic function. /// If an intrinsic function must be implemented by the code generator diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/LoopTraversal.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/LoopTraversal.h index e5810ef1ef26..93d140cabd0d 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/LoopTraversal.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/LoopTraversal.h @@ -98,7 +98,7 @@ public: bool Done = true) : MBB(BB), PrimaryPass(Primary), IsDone(Done) {} }; - LoopTraversal() {} + LoopTraversal() = default; /// Identifies basic blocks that are part of loops and should to be /// visited twice and returns efficient traversal order for all the blocks. diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRFormatter.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRFormatter.h index 3f145ff224ad..fb276ff117af 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRFormatter.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRFormatter.h @@ -30,7 +30,7 @@ public: typedef function_ref<bool(StringRef::iterator Loc, const Twine &)> ErrorCallbackType; - MIRFormatter() {} + MIRFormatter() = default; virtual ~MIRFormatter() = default; /// Implement target specific printing for machine operand immediate value, so diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRYamlMapping.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRYamlMapping.h index 05a375bc251b..02eb5d24271d 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRYamlMapping.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRYamlMapping.h @@ -392,7 +392,7 @@ struct FrameIndex { bool IsFixed; SMRange SourceRange; - FrameIndex() {} + FrameIndex() = default; FrameIndex(int FI, const llvm::MachineFrameInfo &MFI); Expected<int> getFI(const llvm::MachineFrameInfo &MFI) const; @@ -671,7 +671,7 @@ template <> struct MappingTraits<MachineFrameInfo> { /// Targets should override this in a way that mirrors the implementation of /// llvm::MachineFunctionInfo. struct MachineFunctionInfo { - virtual ~MachineFunctionInfo() {} + virtual ~MachineFunctionInfo() = default; virtual void mappingImpl(IO &YamlIO) {} }; diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineFrameInfo.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineFrameInfo.h index 5df468102a8a..864ca73180af 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineFrameInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineFrameInfo.h @@ -49,14 +49,13 @@ class CalleeSavedInfo { /// The long-term solution is to model the liveness of callee-saved registers /// by implicit uses on the return instructions, however, the required /// changes in the ARM backend would be quite extensive. - bool Restored; + bool Restored = true; /// Flag indicating whether the register is spilled to stack or another /// register. - bool SpilledToReg; + bool SpilledToReg = false; public: - explicit CalleeSavedInfo(unsigned R, int FI = 0) - : Reg(R), FrameIdx(FI), Restored(true), SpilledToReg(false) {} + explicit CalleeSavedInfo(unsigned R, int FI = 0) : Reg(R), FrameIdx(FI) {} // Accessors. Register getReg() const { return Reg; } @@ -180,14 +179,14 @@ private: /// If true, the object has been sign-extended. bool isSExt = false; - uint8_t SSPLayout; + uint8_t SSPLayout = SSPLK_None; StackObject(uint64_t Size, Align Alignment, int64_t SPOffset, bool IsImmutable, bool IsSpillSlot, const AllocaInst *Alloca, bool IsAliased, uint8_t StackID = 0) : SPOffset(SPOffset), Size(Size), Alignment(Alignment), isImmutable(IsImmutable), isSpillSlot(IsSpillSlot), StackID(StackID), - Alloca(Alloca), isAliased(IsAliased), SSPLayout(SSPLK_None) {} + Alloca(Alloca), isAliased(IsAliased) {} }; /// The alignment of the stack. diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineModuleSlotTracker.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineModuleSlotTracker.h index 0bd0a31abcae..fc7635edd82c 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineModuleSlotTracker.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineModuleSlotTracker.h @@ -22,7 +22,7 @@ class Module; class MachineModuleSlotTracker : public ModuleSlotTracker { const Function &TheFunction; const MachineModuleInfo &TheMMI; - unsigned MDNStartSlot, MDNEndSlot; + unsigned MDNStartSlot = 0, MDNEndSlot = 0; void processMachineFunctionMetadata(AbstractSlotTrackerStorage *AST, const MachineFunction &MF); diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineOperand.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineOperand.h index f17904d54cdd..eded28183ea2 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineOperand.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineOperand.h @@ -162,7 +162,7 @@ private: /// ParentMI - This is the instruction that this operand is embedded into. /// This is valid for all operand types, when the operand is in an instr. - MachineInstr *ParentMI; + MachineInstr *ParentMI = nullptr; /// Contents union - This contains the payload for the various operand types. union ContentsUnion { @@ -200,7 +200,7 @@ private: } Contents; explicit MachineOperand(MachineOperandType K) - : OpKind(K), SubReg_TargetFlags(0), ParentMI(nullptr) { + : OpKind(K), SubReg_TargetFlags(0) { // Assert that the layout is what we expect. It's easy to grow this object. static_assert(alignof(MachineOperand) <= alignof(int64_t), "MachineOperand shouldn't be more than 8 byte aligned"); diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineOutliner.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineOutliner.h index 3e597e728fef..08b76295dbf2 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineOutliner.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineOutliner.h @@ -124,7 +124,7 @@ public: unsigned FunctionIdx, unsigned Flags) : StartIdx(StartIdx), Len(Len), FirstInst(FirstInst), LastInst(LastInst), MBB(MBB), FunctionIdx(FunctionIdx), Flags(Flags) {} - Candidate() {} + Candidate() = default; /// Used to ensure that \p Candidates are outlined in an order that /// preserves the start and end indices of other \p Candidates. @@ -218,7 +218,7 @@ public: C.Benefit = B; } - OutlinedFunction() {} + OutlinedFunction() = default; }; } // namespace outliner } // namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineRegisterInfo.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineRegisterInfo.h index dbabfe5f0f32..94ae6fe02e9c 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineRegisterInfo.h @@ -84,7 +84,7 @@ private: /// The flag is true upon \p UpdatedCSRs initialization /// and false otherwise. - bool IsUpdatedCSRsInitialized; + bool IsUpdatedCSRsInitialized = false; /// Contains the updated callee saved register list. /// As opposed to the static list defined in register info, diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/ReplaceWithVeclib.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/ReplaceWithVeclib.h index d0fadd55d481..7c0ebe7191e4 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/ReplaceWithVeclib.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/ReplaceWithVeclib.h @@ -16,6 +16,7 @@ #include "llvm/IR/PassManager.h" #include "llvm/InitializePasses.h" +#include "llvm/Pass.h" namespace llvm { struct ReplaceWithVeclib : public PassInfoMixin<ReplaceWithVeclib> { diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h index 94ba6ad91517..9cea197724cc 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h @@ -46,8 +46,8 @@ public: MachineRegisterInfo *RegInfo; SelectionDAG *CurDAG; std::unique_ptr<SelectionDAGBuilder> SDB; - AAResults *AA; - GCFunctionInfo *GFI; + AAResults *AA = nullptr; + GCFunctionInfo *GFI = nullptr; CodeGenOpt::Level OptLevel; const TargetInstrInfo *TII; const TargetLowering *TLI; @@ -199,7 +199,7 @@ public: protected: /// DAGSize - Size of DAG being instruction selected. /// - unsigned DAGSize; + unsigned DAGSize = 0; /// ReplaceUses - replace all uses of the old node F with the use /// of the new node T. diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h index cd62c47abce9..04c6b50197d4 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h @@ -741,11 +741,9 @@ public: using reference = value_type &; use_iterator() = default; - use_iterator(const use_iterator &I) : Op(I.Op) {} + use_iterator(const use_iterator &I) = default; - bool operator==(const use_iterator &x) const { - return Op == x.Op; - } + bool operator==(const use_iterator &x) const { return Op == x.Op; } bool operator!=(const use_iterator &x) const { return !operator==(x); } diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/SlotIndexes.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/SlotIndexes.h index b2133de93ea2..e8d618a24f9b 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/SlotIndexes.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/SlotIndexes.h @@ -319,7 +319,7 @@ class raw_ostream; using IndexList = ilist<IndexListEntry>; IndexList indexList; - MachineFunction *mf; + MachineFunction *mf = nullptr; using Mi2IndexMap = DenseMap<const MachineInstr *, SlotIndex>; Mi2IndexMap mi2iMap; diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/SwitchLoweringUtils.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/SwitchLoweringUtils.h index bc22d7789856..47bedd9befc8 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/SwitchLoweringUtils.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/SwitchLoweringUtils.h @@ -183,12 +183,12 @@ struct JumpTableHeader { const Value *SValue; MachineBasicBlock *HeaderBB; bool Emitted; - bool FallthroughUnreachable; + bool FallthroughUnreachable = false; JumpTableHeader(APInt F, APInt L, const Value *SV, MachineBasicBlock *H, bool E = false) : First(std::move(F)), Last(std::move(L)), SValue(SV), HeaderBB(H), - Emitted(E), FallthroughUnreachable(false) {} + Emitted(E) {} }; using JumpTableBlock = std::pair<JumpTableHeader, JumpTable>; @@ -218,14 +218,14 @@ struct BitTestBlock { BitTestInfo Cases; BranchProbability Prob; BranchProbability DefaultProb; - bool FallthroughUnreachable; + bool FallthroughUnreachable = false; BitTestBlock(APInt F, APInt R, const Value *SV, unsigned Rg, MVT RgVT, bool E, bool CR, MachineBasicBlock *P, MachineBasicBlock *D, BitTestInfo C, BranchProbability Pr) : First(std::move(F)), Range(std::move(R)), SValue(SV), Reg(Rg), RegVT(RgVT), Emitted(E), ContiguousRange(CR), Parent(P), Default(D), - Cases(std::move(C)), Prob(Pr), FallthroughUnreachable(false) {} + Cases(std::move(C)), Prob(Pr) {} }; /// Return the range of values within a range. diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetCallingConv.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetCallingConv.h index 7713dd0800c0..62365330379d 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetCallingConv.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetCallingConv.h @@ -53,9 +53,9 @@ namespace ISD { unsigned IsCopyElisionCandidate : 1; ///< Argument copy elision candidate unsigned IsPointer : 1; - unsigned ByValOrByRefSize; ///< Byval or byref struct size + unsigned ByValOrByRefSize = 0; ///< Byval or byref struct size - unsigned PointerAddrSpace; ///< Address space of pointer argument + unsigned PointerAddrSpace = 0; ///< Address space of pointer argument public: ArgFlagsTy() @@ -65,8 +65,7 @@ namespace ISD { IsSwiftError(0), IsCFGuardTarget(0), IsHva(0), IsHvaStart(0), IsSecArgPass(0), MemAlign(0), OrigAlign(0), IsInConsecutiveRegsLast(0), IsInConsecutiveRegs(0), - IsCopyElisionCandidate(0), IsPointer(0), ByValOrByRefSize(0), - PointerAddrSpace(0) { + IsCopyElisionCandidate(0), IsPointer(0) { static_assert(sizeof(*this) == 3 * sizeof(unsigned), "flags are too big"); } diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h index bec191570594..3861648a5feb 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h @@ -3485,13 +3485,19 @@ public: bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits, DAGCombinerInfo &DCI) const; + /// Helper wrapper around SimplifyDemandedBits. + /// Adds Op back to the worklist upon success. + bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits, + const APInt &DemandedElts, + DAGCombinerInfo &DCI) const; + /// More limited version of SimplifyDemandedBits that can be used to "look /// through" ops that don't contribute to the DemandedBits/DemandedElts - /// bitwise ops etc. SDValue SimplifyMultipleUseDemandedBits(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, SelectionDAG &DAG, - unsigned Depth) const; + unsigned Depth = 0) const; /// Helper wrapper around SimplifyMultipleUseDemandedBits, demanding all /// elements. @@ -3676,11 +3682,11 @@ public: /// Return if the N is a constant or constant vector equal to the true value /// from getBooleanContents(). - bool isConstTrueVal(const SDNode *N) const; + bool isConstTrueVal(SDValue N) const; /// Return if the N is a constant or constant vector equal to the false value /// from getBooleanContents(). - bool isConstFalseVal(const SDNode *N) const; + bool isConstFalseVal(SDValue N) const; /// Return if \p N is a True value when extended to \p VT. bool isExtendedTrueVal(const ConstantSDNode *N, EVT VT, bool SExt) const; diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/VirtRegMap.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/VirtRegMap.h index 4953d88340b1..42e8d294a637 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/VirtRegMap.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/VirtRegMap.h @@ -39,10 +39,10 @@ class TargetInstrInfo; }; private: - MachineRegisterInfo *MRI; - const TargetInstrInfo *TII; - const TargetRegisterInfo *TRI; - MachineFunction *MF; + MachineRegisterInfo *MRI = nullptr; + const TargetInstrInfo *TII = nullptr; + const TargetRegisterInfo *TRI = nullptr; + MachineFunction *MF = nullptr; /// Virt2PhysMap - This is a virtual to physical register /// mapping. Each virtual register is required to have an entry in @@ -72,8 +72,7 @@ class TargetInstrInfo; static char ID; VirtRegMap() - : MachineFunctionPass(ID), MRI(nullptr), TII(nullptr), TRI(nullptr), - MF(nullptr), Virt2PhysMap(NO_PHYS_REG), + : MachineFunctionPass(ID), Virt2PhysMap(NO_PHYS_REG), Virt2StackSlotMap(NO_STACK_SLOT), Virt2SplitMap(0) {} VirtRegMap(const VirtRegMap &) = delete; VirtRegMap &operator=(const VirtRegMap &) = delete; diff --git a/contrib/llvm-project/llvm/include/llvm/DWARFLinker/DWARFStreamer.h b/contrib/llvm-project/llvm/include/llvm/DWARFLinker/DWARFStreamer.h index 9a5c6bcaf83f..fc8c59904cfb 100644 --- a/contrib/llvm-project/llvm/include/llvm/DWARFLinker/DWARFStreamer.h +++ b/contrib/llvm-project/llvm/include/llvm/DWARFLinker/DWARFStreamer.h @@ -9,6 +9,7 @@ #ifndef LLVM_DWARFLINKER_DWARFSTREAMER_H #define LLVM_DWARFLINKER_DWARFSTREAMER_H +#include "llvm/BinaryFormat/Swift.h" #include "llvm/CodeGen/AccelTable.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/DWARFLinker/DWARFLinker.h" @@ -48,7 +49,7 @@ public: : OutFile(OutFile), OutFileType(OutFileType), Translator(Translator), ErrorHandler(Error), WarningHandler(Warning) {} - bool init(Triple TheTriple); + bool init(Triple TheTriple, StringRef Swift5ReflectionSegmentName); /// Dump the file to the disk. void finish(); @@ -85,6 +86,11 @@ public: /// Emit the swift_ast section stored in \p Buffer. void emitSwiftAST(StringRef Buffer); + /// Emit the swift reflection section stored in \p Buffer. + void emitSwiftReflectionSection( + llvm::binaryformat::Swift5ReflectionSectionKind ReflSectionKind, + StringRef Buffer, uint32_t Alignment, uint32_t Size); + /// Emit debug_ranges for \p FuncRange by translating the /// original \p Entries. void emitRangesEntries( diff --git a/contrib/llvm-project/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h b/contrib/llvm-project/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h index 536583e20640..8167aaaeffb5 100644 --- a/contrib/llvm-project/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h +++ b/contrib/llvm-project/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h @@ -535,7 +535,7 @@ public: : Kind(K), IsDWARF64(IsDWARF64), Offset(Offset), Length(Length), CFIs(CodeAlign, DataAlign, Arch) {} - virtual ~FrameEntry() {} + virtual ~FrameEntry() = default; FrameKind getKind() const { return Kind; } uint64_t getOffset() const { return Offset; } diff --git a/contrib/llvm-project/llvm/include/llvm/DebugInfo/GSYM/StringTable.h b/contrib/llvm-project/llvm/include/llvm/DebugInfo/GSYM/StringTable.h index 6dd90499c203..d920335d373e 100644 --- a/contrib/llvm-project/llvm/include/llvm/DebugInfo/GSYM/StringTable.h +++ b/contrib/llvm-project/llvm/include/llvm/DebugInfo/GSYM/StringTable.h @@ -20,7 +20,7 @@ namespace gsym { /// string at offset zero. Strings must be UTF8 NULL terminated strings. struct StringTable { StringRef Data; - StringTable() {} + StringTable() = default; StringTable(StringRef D) : Data(D) {} StringRef operator[](size_t Offset) const { return getString(Offset); } StringRef getString(uint32_t Offset) const { diff --git a/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h b/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h index 779dc885372d..91748e15ba65 100644 --- a/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h +++ b/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h @@ -39,8 +39,8 @@ struct Request { class DIPrinter { public: - DIPrinter() {} - virtual ~DIPrinter() {} + DIPrinter() = default; + virtual ~DIPrinter() = default; virtual void print(const Request &Request, const DILineInfo &Info) = 0; virtual void print(const Request &Request, const DIInliningInfo &Info) = 0; diff --git a/contrib/llvm-project/llvm/include/llvm/Demangle/ItaniumDemangle.h b/contrib/llvm-project/llvm/include/llvm/Demangle/ItaniumDemangle.h index 28545ed06836..760319544a02 100644 --- a/contrib/llvm-project/llvm/include/llvm/Demangle/ItaniumDemangle.h +++ b/contrib/llvm-project/llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -1,15 +1,15 @@ -// Do not edit! -*- read-only -*- -// See README.txt for instructions -//===------------------------- ItaniumDemangle.h ----------------*- C++ -*-===// -// +//===--- ItaniumDemangle.h -----------*- mode:c++;eval:(read-only-mode) -*-===// +// Do not edit! See README.txt. // 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 // //===----------------------------------------------------------------------===// // -// Generic itanium demangler library. This file has two byte-per-byte identical -// copies in the source tree, one in libcxxabi, and the other in llvm. +// Generic itanium demangler library. +// There are two copies of this file in the source tree. The one under +// libcxxabi is the original and the one under llvm is the copy. Use +// cp-to-llvm.sh to update the copy. See README.txt for more details. // //===----------------------------------------------------------------------===// diff --git a/contrib/llvm-project/llvm/include/llvm/Demangle/README.txt b/contrib/llvm-project/llvm/include/llvm/Demangle/README.txt index 514ff6dd16f2..76470f61f959 100644 --- a/contrib/llvm-project/llvm/include/llvm/Demangle/README.txt +++ b/contrib/llvm-project/llvm/include/llvm/Demangle/README.txt @@ -4,41 +4,50 @@ Itanium Name Demangler Library Introduction ------------ -This directory contains the generic itanium name demangler library. The main -purpose of the library is to demangle C++ symbols, i.e. convert the string -"_Z1fv" into "f()". You can also use the CRTP base ManglingParser to perform -some simple analysis on the mangled name, or (in LLVM) use the opaque -ItaniumPartialDemangler to query the demangled AST. +This directory contains the generic itanium name demangler +library. The main purpose of the library is to demangle C++ symbols, +i.e. convert the string "_Z1fv" into "f()". You can also use the CRTP +base ManglingParser to perform some simple analysis on the mangled +name, or (in LLVM) use the opaque ItaniumPartialDemangler to query the +demangled AST. Why are there multiple copies of the this library in the source tree? --------------------------------------------------------------------- -This directory is mirrored between libcxxabi/demangle and -llvm/include/llvm/Demangle. The simple reason for this is that both projects -need to demangle symbols, but neither can depend on each other. libcxxabi needs -the demangler to implement __cxa_demangle, which is part of the itanium ABI -spec. LLVM needs a copy for a bunch of places, but doesn't want to use the -system's __cxa_demangle because it a) might not be available (i.e., on Windows), -and b) probably isn't that up-to-date on the latest language features. - -The copy of the demangler in LLVM has some extra stuff that aren't needed in -libcxxabi (ie, the MSVC demangler, ItaniumPartialDemangler), which depend on the -shared generic components. Despite these differences, we want to keep the "core" -generic demangling library identical between both copies to simplify development -and testing. - -If you're working on the generic library, then do the work first in libcxxabi, -then run the cp-to-llvm.sh script in src/demangle. This script takes as an -argument the path to llvm, and re-copies the changes you made to libcxxabi over. -Note that this script just blindly overwrites all changes to the generic library -in llvm, so be careful. - -Because the core demangler needs to work in libcxxabi, everything needs to be -declared in an anonymous namespace (see DEMANGLE_NAMESPACE_BEGIN), and you can't -introduce any code that depends on the libcxx dylib. - -Hopefully, when LLVM becomes a monorepo, we can de-duplicate this code, and have -both LLVM and libcxxabi depend on a shared demangler library. +The canonical sources are in libcxxabi/src/demangle and some of the +files are copied to llvm/include/llvm/Demangle. The simple reason for +this comes from before the monorepo, and both [sub]projects need to +demangle symbols, but neither can depend on each other. + +* libcxxabi needs the demangler to implement __cxa_demangle, which is + part of the itanium ABI spec. + +* LLVM needs a copy for a bunch of places, and cannot rely on the + system's __cxa_demangle because it a) might not be available (i.e., + on Windows), and b) may not be up-to-date on the latest language + features. + +The copy of the demangler in LLVM has some extra stuff that aren't +needed in libcxxabi (ie, the MSVC demangler, ItaniumPartialDemangler), +which depend on the shared generic components. Despite these +differences, we want to keep the "core" generic demangling library +identical between both copies to simplify development and testing. + +If you're working on the generic library, then do the work first in +libcxxabi, then run the cp-to-llvm.sh script in src/demangle. This +script takes as an optional argument the path to llvm, and copies the +changes you made to libcxxabi over. Note that this script just +blindly overwrites all changes to the generic library in llvm, so be +careful. + +Because the core demangler needs to work in libcxxabi, everything +needs to be declared in an anonymous namespace (see +DEMANGLE_NAMESPACE_BEGIN), and you can't introduce any code that +depends on the libcxx dylib. + +FIXME: Now that LLVM is a monorepo, it should be possible to +de-duplicate this code, and have both LLVM and libcxxabi depend on a +shared demangler library. Testing ------- diff --git a/contrib/llvm-project/llvm/include/llvm/Demangle/StringView.h b/contrib/llvm-project/llvm/include/llvm/Demangle/StringView.h index 323282f69c26..6bbb8837fed1 100644 --- a/contrib/llvm-project/llvm/include/llvm/Demangle/StringView.h +++ b/contrib/llvm-project/llvm/include/llvm/Demangle/StringView.h @@ -1,7 +1,5 @@ -// Do not edit! -*- read-only -*- -// See README.txt for instructions -//===--- StringView.h -------------------------------------------*- C++ -*-===// -// +//===--- StringView.h ----------------*- mode:c++;eval:(read-only-mode) -*-===// +// Do not edit! See README.txt. // 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 @@ -9,6 +7,9 @@ //===----------------------------------------------------------------------===// // // FIXME: Use std::string_view instead when we support C++17. +// There are two copies of this file in the source tree. The one under +// libcxxabi is the original and the one under llvm is the copy. Use +// cp-to-llvm.sh to update the copy. See README.txt for more details. // //===----------------------------------------------------------------------===// diff --git a/contrib/llvm-project/llvm/include/llvm/Demangle/Utility.h b/contrib/llvm-project/llvm/include/llvm/Demangle/Utility.h index bec019da8680..1cf7e8f1df45 100644 --- a/contrib/llvm-project/llvm/include/llvm/Demangle/Utility.h +++ b/contrib/llvm-project/llvm/include/llvm/Demangle/Utility.h @@ -1,14 +1,15 @@ -// Do not edit! -*- read-only -*- -// See README.txt for instructions -//===--- Utility.h ----------------------------------------------*- C++ -*-===// -// +//===--- Utility.h -------------------*- mode:c++;eval:(read-only-mode) -*-===// +// Do not edit! See README.txt. // 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 // //===----------------------------------------------------------------------===// // -// Provide some utility classes for use in the demangler(s). +// Provide some utility classes for use in the demangler. +// There are two copies of this file in the source tree. The one in libcxxabi +// is the original and the one in llvm is the copy. Use cp-to-llvm.sh to update +// the copy. See README.txt for more details. // //===----------------------------------------------------------------------===// diff --git a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index ddbb3e76f145..25f1349f15f2 100644 --- a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -1636,7 +1636,7 @@ using AsyncLookupResult = DenseMap<StringRef, JITEvaluatedSymbol>; /// or an error if resolution failed. class JITLinkAsyncLookupContinuation { public: - virtual ~JITLinkAsyncLookupContinuation() {} + virtual ~JITLinkAsyncLookupContinuation() = default; virtual void run(Expected<AsyncLookupResult> LR) = 0; private: diff --git a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Core.h index d0168f79e3d8..c4647148f287 100644 --- a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Core.h +++ b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Core.h @@ -686,7 +686,7 @@ public: MaterializationUnit(Interface I) : SymbolFlags(std::move(I.SymbolFlags)), InitSymbol(std::move(I.InitSymbol)) {} - virtual ~MaterializationUnit() {} + virtual ~MaterializationUnit() = default; /// Return the name of this materialization unit. Useful for debugging /// output. diff --git a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/DebuggerSupportPlugin.h b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/DebuggerSupportPlugin.h index d2bf8330695f..253b1c876782 100644 --- a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/DebuggerSupportPlugin.h +++ b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/DebuggerSupportPlugin.h @@ -29,7 +29,7 @@ class GDBJITDebugInfoRegistrationPlugin : public ObjectLinkingLayer::Plugin { public: class DebugSectionSynthesizer { public: - virtual ~DebugSectionSynthesizer() {} + virtual ~DebugSectionSynthesizer() = default; virtual Error startSynthesis() = 0; virtual Error completeSynthesisAndRegister() = 0; }; diff --git a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h index 940d0d28ae83..ac7051b5b75c 100644 --- a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h +++ b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h @@ -34,7 +34,7 @@ class ExecutionSession; class DebugObjectRegistrar { public: virtual Error registerDebugObject(ExecutorAddrRange TargetMem) = 0; - virtual ~DebugObjectRegistrar() {} + virtual ~DebugObjectRegistrar() = default; }; /// Use ExecutorProcessControl to register debug objects locally or in a remote diff --git a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/TaskDispatch.h b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/TaskDispatch.h index c57264e59655..8c287f9fec0e 100644 --- a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/TaskDispatch.h +++ b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/TaskDispatch.h @@ -35,7 +35,7 @@ class Task : public RTTIExtends<Task, RTTIRoot> { public: static char ID; - virtual ~Task() {} + virtual ~Task() = default; /// Description of the task to be performed. Used for logging. virtual void printDescription(raw_ostream &OS) = 0; diff --git a/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h b/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h index 2178acc90e2c..bee90281e086 100644 --- a/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h +++ b/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h @@ -113,6 +113,9 @@ enum class AddressSpace : unsigned { Local = 5, }; +/// \note This needs to be kept in sync with interop.h enum kmp_interop_type_t.: +enum class OMPInteropType { Unknown, Target, TargetSync }; + } // end namespace omp } // end namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h index 85dd28ec3159..f60debe8411c 100644 --- a/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h +++ b/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h @@ -1003,6 +1003,55 @@ public: llvm::ConstantInt *Size, const llvm::Twine &Name = Twine("")); + /// Create a runtime call for __tgt_interop_init + /// + /// \param Loc The insert and source location description. + /// \param InteropVar variable to be allocated + /// \param InteropType type of interop operation + /// \param Device devide to which offloading will occur + /// \param NumDependences number of dependence variables + /// \param DependenceAddress pointer to dependence variables + /// \param HaveNowaitClause does nowait clause exist + /// + /// \returns CallInst to the __tgt_interop_init call + CallInst *createOMPInteropInit(const LocationDescription &Loc, + Value *InteropVar, + omp::OMPInteropType InteropType, Value *Device, + Value *NumDependences, + Value *DependenceAddress, + bool HaveNowaitClause); + + /// Create a runtime call for __tgt_interop_destroy + /// + /// \param Loc The insert and source location description. + /// \param InteropVar variable to be allocated + /// \param Device devide to which offloading will occur + /// \param NumDependences number of dependence variables + /// \param DependenceAddress pointer to dependence variables + /// \param HaveNowaitClause does nowait clause exist + /// + /// \returns CallInst to the __tgt_interop_destroy call + CallInst *createOMPInteropDestroy(const LocationDescription &Loc, + Value *InteropVar, Value *Device, + Value *NumDependences, + Value *DependenceAddress, + bool HaveNowaitClause); + + /// Create a runtime call for __tgt_interop_use + /// + /// \param Loc The insert and source location description. + /// \param InteropVar variable to be allocated + /// \param Device devide to which offloading will occur + /// \param NumDependences number of dependence variables + /// \param DependenceAddress pointer to dependence variables + /// \param HaveNowaitClause does nowait clause exist + /// + /// \returns CallInst to the __tgt_interop_use call + CallInst *createOMPInteropUse(const LocationDescription &Loc, + Value *InteropVar, Value *Device, + Value *NumDependences, Value *DependenceAddress, + bool HaveNowaitClause); + /// The `omp target` interface /// /// For more information about the usage of this interface, @@ -1167,6 +1216,7 @@ private: /// /// \param AllocIP Instruction to create AllocaInst before. /// \param X The target atomic pointer to be updated + /// \param XElemTy The element type of the atomic pointer. /// \param Expr The value to update X with. /// \param AO Atomic ordering of the generated atomic /// instructions. @@ -1183,12 +1233,11 @@ private: /// /// \returns A pair of the old value of X before the update, and the value /// used for the update. - std::pair<Value *, Value *> emitAtomicUpdate(Instruction *AllocIP, Value *X, - Value *Expr, AtomicOrdering AO, - AtomicRMWInst::BinOp RMWOp, - AtomicUpdateCallbackTy &UpdateOp, - bool VolatileX, - bool IsXBinopExpr); + std::pair<Value *, Value *> + emitAtomicUpdate(Instruction *AllocIP, Value *X, Type *XElemTy, Value *Expr, + AtomicOrdering AO, AtomicRMWInst::BinOp RMWOp, + AtomicUpdateCallbackTy &UpdateOp, bool VolatileX, + bool IsXBinopExpr); /// Emit the binary op. described by \p RMWOp, using \p Src1 and \p Src2 . /// @@ -1200,6 +1249,7 @@ public: /// a struct to pack relevant information while generating atomic Ops struct AtomicOpValue { Value *Var = nullptr; + Type *ElemTy = nullptr; bool IsSigned = false; bool IsVolatile = false; }; diff --git a/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def index d2b70edd4d87..0c3cb3f43105 100644 --- a/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def +++ b/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def @@ -386,6 +386,13 @@ __OMP_RTL(__kmpc_aligned_alloc, false, VoidPtr, /* Int */ Int32, SizeTy, SizeTy, VoidPtr) __OMP_RTL(__kmpc_free, false, Void, /* Int */ Int32, VoidPtr, VoidPtr) +__OMP_RTL(__tgt_interop_init, false, Void, IdentPtr, Int32, VoidPtrPtr, Int64, + Int32, Int32, VoidPtr, Int32) +__OMP_RTL(__tgt_interop_destroy, false, Void, IdentPtr, Int32, VoidPtrPtr, + Int32, Int32, VoidPtr, Int32) +__OMP_RTL(__tgt_interop_use, false, Void, IdentPtr, Int32, VoidPtrPtr, Int32, + Int32, VoidPtr, Int32) + __OMP_RTL(__kmpc_init_allocator, false, /* omp_allocator_handle_t */ VoidPtr, /* Int */ Int32, /* omp_memespace_handle_t */ VoidPtr, /* Int */ Int32, /* omp_alloctrait_t */ VoidPtr) diff --git a/contrib/llvm-project/llvm/include/llvm/IR/AbstractCallSite.h b/contrib/llvm-project/llvm/include/llvm/IR/AbstractCallSite.h index 31df4c75b6e7..69048554a05c 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/AbstractCallSite.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/AbstractCallSite.h @@ -14,11 +14,11 @@ #ifndef LLVM_IR_ABSTRACTCALLSITE_H #define LLVM_IR_ABSTRACTCALLSITE_H +#include "llvm/IR/Argument.h" +#include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" #include "llvm/IR/InstrTypes.h" -#include "llvm/IR/Instruction.h" #include "llvm/IR/Use.h" -#include "llvm/IR/User.h" #include "llvm/IR/Value.h" #include "llvm/Support/Casting.h" #include <cassert> diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Attributes.h b/contrib/llvm-project/llvm/include/llvm/IR/Attributes.h index 5e2cfe6d81ac..74b60f1e3d05 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/Attributes.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/Attributes.h @@ -20,7 +20,6 @@ #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/iterator_range.h" #include "llvm/Config/llvm-config.h" #include "llvm/Support/Alignment.h" #include "llvm/Support/PointerLikeTypeTraits.h" diff --git a/contrib/llvm-project/llvm/include/llvm/IR/CFG.h b/contrib/llvm-project/llvm/include/llvm/IR/CFG.h index b872e2626981..0ee584f8af7e 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/CFG.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/CFG.h @@ -22,6 +22,7 @@ #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator.h" #include "llvm/ADT/iterator_range.h" +#include "llvm/IR/BasicBlock.h" #include "llvm/IR/Function.h" #include "llvm/IR/Value.h" #include "llvm/Support/Casting.h" @@ -31,7 +32,6 @@ namespace llvm { -class BasicBlock; class Instruction; class Use; diff --git a/contrib/llvm-project/llvm/include/llvm/IR/DIBuilder.h b/contrib/llvm-project/llvm/include/llvm/IR/DIBuilder.h index f36c9e620d43..fc461fc3f49f 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/DIBuilder.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/DIBuilder.h @@ -21,7 +21,6 @@ #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/IR/DebugInfo.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/TrackingMDRef.h" #include "llvm/Support/Casting.h" diff --git a/contrib/llvm-project/llvm/include/llvm/IR/DebugInfoMetadata.h b/contrib/llvm-project/llvm/include/llvm/IR/DebugInfoMetadata.h index ba2568042c41..96569179060f 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/DebugInfoMetadata.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/DebugInfoMetadata.h @@ -33,7 +33,6 @@ #include <cstddef> #include <cstdint> #include <iterator> -#include <type_traits> #include <vector> // Helper macros for defining get() overrides. diff --git a/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h b/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h index 73b0be43e136..1ea1d9787d61 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h @@ -15,14 +15,16 @@ #define LLVM_IR_DIAGNOSTICINFO_H #include "llvm-c/Types.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/IR/DebugLoc.h" #include "llvm/Support/CBindingWrapping.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/SourceMgr.h" #include "llvm/Support/TypeSize.h" -#include "llvm/Support/YAMLTraits.h" #include <algorithm> #include <cstdint> #include <functional> @@ -33,13 +35,15 @@ namespace llvm { // Forward declarations. class DiagnosticPrinter; +class DIFile; +class DISubprogram; class CallInst; class Function; class Instruction; class InstructionCost; -class LLVMContext; class Module; -class SMDiagnostic; +class Type; +class Value; /// Defines the different supported severity of a diagnostic. enum DiagnosticSeverity : char { @@ -1049,18 +1053,20 @@ static DiagnosticSeverity getDiagnosticSeverity(SourceMgr::DiagKind DK) { /// Diagnostic information for SMDiagnostic reporting. class DiagnosticInfoSrcMgr : public DiagnosticInfo { const SMDiagnostic &Diagnostic; + StringRef ModName; // For inlineasm !srcloc translation. bool InlineAsmDiag; unsigned LocCookie; public: - DiagnosticInfoSrcMgr(const SMDiagnostic &Diagnostic, + DiagnosticInfoSrcMgr(const SMDiagnostic &Diagnostic, StringRef ModName, bool InlineAsmDiag = true, unsigned LocCookie = 0) : DiagnosticInfo(DK_SrcMgr, getDiagnosticSeverity(Diagnostic.getKind())), - Diagnostic(Diagnostic), InlineAsmDiag(InlineAsmDiag), + Diagnostic(Diagnostic), ModName(ModName), InlineAsmDiag(InlineAsmDiag), LocCookie(LocCookie) {} + StringRef getModuleName() const { return ModName; } bool isInlineAsmDiag() const { return InlineAsmDiag; } const SMDiagnostic &getSMDiag() const { return Diagnostic; } unsigned getLocCookie() const { return LocCookie; } diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Dominators.h b/contrib/llvm-project/llvm/include/llvm/IR/Dominators.h index 475355af5647..d13a5856df3b 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/Dominators.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/Dominators.h @@ -14,23 +14,34 @@ #ifndef LLVM_IR_DOMINATORS_H #define LLVM_IR_DOMINATORS_H +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/DepthFirstIterator.h" -#include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/Hashing.h" +#include "llvm/ADT/PointerIntPair.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Twine.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CFG.h" #include "llvm/IR/PassManager.h" +#include "llvm/IR/Use.h" #include "llvm/Pass.h" +#include "llvm/Support/CFGDiff.h" +#include "llvm/Support/CFGUpdate.h" #include "llvm/Support/GenericDomTree.h" +#include "llvm/Support/GenericDomTreeConstruction.h" #include <utility> +#include <vector> namespace llvm { class Function; class Instruction; class Module; +class Value; class raw_ostream; +template <class GraphType> struct GraphTraits; extern template class DomTreeNodeBase<BasicBlock>; extern template class DominatorTreeBase<BasicBlock, false>; // DomTree diff --git a/contrib/llvm-project/llvm/include/llvm/IR/IRBuilder.h b/contrib/llvm-project/llvm/include/llvm/IR/IRBuilder.h index 53f517480ca1..a1789759960d 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/IRBuilder.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/IRBuilder.h @@ -28,12 +28,13 @@ #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DebugLoc.h" #include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/FPEnv.h" #include "llvm/IR/Function.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/InstrTypes.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" -#include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/Intrinsics.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/IR/Operator.h" @@ -44,7 +45,6 @@ #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/Casting.h" #include <cassert> -#include <cstddef> #include <cstdint> #include <functional> #include <utility> @@ -52,7 +52,6 @@ namespace llvm { class APInt; -class MDNode; class Use; /// This provides the default implementation of the IRBuilder diff --git a/contrib/llvm-project/llvm/include/llvm/IR/IRPrintingPasses.h b/contrib/llvm-project/llvm/include/llvm/IR/IRPrintingPasses.h index 2e62be7cd1ec..3fba5b81e37a 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/IRPrintingPasses.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/IRPrintingPasses.h @@ -24,6 +24,11 @@ namespace llvm { class raw_ostream; class StringRef; +class Function; +class FunctionPass; +class Module; +class ModulePass; +class Pass; /// Create and return a pass that writes the module to the specified /// \c raw_ostream. diff --git a/contrib/llvm-project/llvm/include/llvm/IR/InstrTypes.h b/contrib/llvm-project/llvm/include/llvm/IR/InstrTypes.h index b3d2a2c8ed9d..589926c0faf1 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/InstrTypes.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/InstrTypes.h @@ -1393,10 +1393,13 @@ public: const Use &getCalledOperandUse() const { return Op<CalledOperandOpEndIdx>(); } Use &getCalledOperandUse() { return Op<CalledOperandOpEndIdx>(); } - /// Returns the function called, or null if this is an - /// indirect function invocation. + /// Returns the function called, or null if this is an indirect function + /// invocation or the function signature does not match the call signature. Function *getCalledFunction() const { - return dyn_cast_or_null<Function>(getCalledOperand()); + if (auto *F = dyn_cast_or_null<Function>(getCalledOperand())) + if (F->getValueType() == getFunctionType()) + return F; + return nullptr; } /// Return true if the callsite is an indirect call. diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Instruction.h b/contrib/llvm-project/llvm/include/llvm/IR/Instruction.h index 9878082ffffa..1937ffd36f7b 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/Instruction.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/Instruction.h @@ -25,8 +25,6 @@ #include "llvm/IR/Value.h" #include "llvm/Support/AtomicOrdering.h" #include "llvm/Support/Casting.h" -#include <algorithm> -#include <cassert> #include <cstdint> #include <utility> diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Instructions.h b/contrib/llvm-project/llvm/include/llvm/IR/Instructions.h index 84ebb461ebef..5929cff3b4fb 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/Instructions.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/Instructions.h @@ -27,11 +27,9 @@ #include "llvm/ADT/iterator_range.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/BasicBlock.h" -#include "llvm/IR/CallingConv.h" #include "llvm/IR/CFG.h" #include "llvm/IR/Constant.h" #include "llvm/IR/DerivedTypes.h" -#include "llvm/IR/Function.h" #include "llvm/IR/InstrTypes.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/OperandTraits.h" @@ -52,7 +50,6 @@ namespace llvm { class APInt; class ConstantInt; class DataLayout; -class LLVMContext; //===----------------------------------------------------------------------===// // AllocaInst Class diff --git a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h index f4e571e86493..01dada25a285 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h @@ -1194,6 +1194,17 @@ public: ConstantInt *getIndex() const; }; +/// This represents the llvm.instrprof.cover intrinsic. +class InstrProfCoverInst : public InstrProfInstBase { +public: + static bool classof(const IntrinsicInst *I) { + return I->getIntrinsicID() == Intrinsic::instrprof_cover; + } + static bool classof(const Value *V) { + return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V)); + } +}; + /// This represents the llvm.instrprof.increment intrinsic. class InstrProfIncrementInst : public InstrProfInstBase { public: diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Intrinsics.td b/contrib/llvm-project/llvm/include/llvm/IR/Intrinsics.td index 3e40bbf39dd4..f5248e82ad21 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/Intrinsics.td +++ b/contrib/llvm-project/llvm/include/llvm/IR/Intrinsics.td @@ -582,6 +582,10 @@ def int_experimental_noalias_scope_decl def int_stackprotector : DefaultAttrsIntrinsic<[], [llvm_ptr_ty, llvm_ptrptr_ty], []>; def int_stackguard : DefaultAttrsIntrinsic<[llvm_ptr_ty], [], []>; +// A cover for instrumentation based profiling. +def int_instrprof_cover : Intrinsic<[], [llvm_ptr_ty, llvm_i64_ty, + llvm_i32_ty, llvm_i32_ty]>; + // A counter increment for instrumentation based profiling. def int_instrprof_increment : Intrinsic<[], [llvm_ptr_ty, llvm_i64_ty, diff --git a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAArch64.td b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAArch64.td index e610c28a5923..a65ddff07a29 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAArch64.td +++ b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAArch64.td @@ -897,6 +897,14 @@ def int_aarch64_stgp : DefaultAttrsIntrinsic<[], [llvm_ptr_ty, llvm_i64_ty, llv [IntrWriteMem, IntrArgMemOnly, NoCapture<ArgIndex<0>>, WriteOnly<ArgIndex<0>>]>; } +//===----------------------------------------------------------------------===// +// Memory Operations (MOPS) Intrinsics +let TargetPrefix = "aarch64" in { + // Sizes are chosen to correspond to the llvm.memset intrinsic: ptr, i8, i64 + def int_aarch64_mops_memset_tag : DefaultAttrsIntrinsic<[llvm_ptr_ty], [llvm_ptr_ty, llvm_i8_ty, llvm_i64_ty], + [IntrWriteMem, IntrArgMemOnly, NoCapture<ArgIndex<0>>, WriteOnly<ArgIndex<0>>]>; +} + // Transactional Memory Extension (TME) Intrinsics let TargetPrefix = "aarch64" in { def int_aarch64_tstart : GCCBuiltin<"__builtin_arm_tstart">, diff --git a/contrib/llvm-project/llvm/include/llvm/IR/LLVMContext.h b/contrib/llvm-project/llvm/include/llvm/IR/LLVMContext.h index d165a405ce22..446bcecf1c64 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/LLVMContext.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/LLVMContext.h @@ -36,7 +36,6 @@ template <typename T> class StringMapEntry; class StringRef; class Twine; class LLVMRemarkStreamer; -class raw_ostream; namespace remarks { class RemarkStreamer; diff --git a/contrib/llvm-project/llvm/include/llvm/IR/LLVMRemarkStreamer.h b/contrib/llvm-project/llvm/include/llvm/IR/LLVMRemarkStreamer.h index e7627e993370..094ead273eed 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/LLVMRemarkStreamer.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/LLVMRemarkStreamer.h @@ -14,14 +14,20 @@ #ifndef LLVM_IR_LLVMREMARKSTREAMER_H #define LLVM_IR_LLVMREMARKSTREAMER_H -#include "llvm/IR/DiagnosticInfo.h" -#include "llvm/Remarks/RemarkStreamer.h" +#include "llvm/Remarks/Remark.h" #include "llvm/Support/Error.h" -#include "llvm/Support/ToolOutputFile.h" #include <memory> #include <string> namespace llvm { + +class DiagnosticInfoOptimizationBase; +class LLVMContext; +class ToolOutputFile; +namespace remarks { +class RemarkStreamer; +} + /// Streamer for LLVM remarks which has logic for dealing with DiagnosticInfo /// objects. class LLVMRemarkStreamer { diff --git a/contrib/llvm-project/llvm/include/llvm/IR/LegacyPassManager.h b/contrib/llvm-project/llvm/include/llvm/IR/LegacyPassManager.h index 2459f0a5450a..b3a4820ba0e4 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/LegacyPassManager.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/LegacyPassManager.h @@ -16,11 +16,11 @@ #ifndef LLVM_IR_LEGACYPASSMANAGER_H #define LLVM_IR_LEGACYPASSMANAGER_H -#include "llvm/Pass.h" #include "llvm/Support/CBindingWrapping.h" namespace llvm { +class Function; class Pass; class Module; diff --git a/contrib/llvm-project/llvm/include/llvm/IR/MDBuilder.h b/contrib/llvm-project/llvm/include/llvm/IR/MDBuilder.h index 51be8667f1c1..42829388b79a 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/MDBuilder.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/MDBuilder.h @@ -16,7 +16,6 @@ #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringRef.h" -#include "llvm/IR/Constants.h" #include "llvm/IR/GlobalValue.h" #include "llvm/Support/DataTypes.h" #include <utility> @@ -28,6 +27,7 @@ template <typename T> class ArrayRef; class LLVMContext; class Constant; class ConstantAsMetadata; +class Function; class MDNode; class MDString; class Metadata; diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Metadata.h b/contrib/llvm-project/llvm/include/llvm/IR/Metadata.h index 26d70b4db2d5..7965884990e5 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/Metadata.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/Metadata.h @@ -20,9 +20,7 @@ #include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/None.h" #include "llvm/ADT/PointerUnion.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/ilist_node.h" #include "llvm/ADT/iterator_range.h" @@ -46,6 +44,8 @@ namespace llvm { class Module; class ModuleSlotTracker; class raw_ostream; +template <typename T> class StringMapEntry; +template <typename ValueTy> class StringMapEntryStorage; class Type; enum LLVMConstants : uint32_t { @@ -682,6 +682,10 @@ struct AAMDNodes { // Shift tbaa.struct Metadata node to start off bytes later static MDNode *shiftTBAAStruct(MDNode *M, size_t off); + // Extend tbaa Metadata node to apply to a series of bytes of length len. + // A size of -1 denotes an unknown size. + static MDNode *extendToTBAA(MDNode *TBAA, ssize_t len); + /// Given two sets of AAMDNodes that apply to the same pointer, /// give the best AAMDNodes that are compatible with both (i.e. a set of /// nodes whose allowable aliasing conclusions are a subset of those @@ -708,6 +712,21 @@ struct AAMDNodes { return Result; } + /// Create a new AAMDNode that describes this AAMDNode after extending it to + /// apply to a series of bytes of length Len. A size of -1 denotes an unknown + /// size. + AAMDNodes extendTo(ssize_t Len) const { + AAMDNodes Result; + Result.TBAA = TBAA ? extendToTBAA(TBAA, Len) : nullptr; + // tbaa.struct contains (offset, size, type) triples. Extending the length + // of the tbaa.struct doesn't require changing this (though more information + // could be provided by adding more triples at subsequent lengths). + Result.TBAAStruct = TBAAStruct; + Result.Scope = Scope; + Result.NoAlias = NoAlias; + return Result; + } + /// Given two sets of AAMDNodes applying to potentially different locations, /// determine the best AAMDNodes that apply to both. AAMDNodes merge(const AAMDNodes &Other) const; diff --git a/contrib/llvm-project/llvm/include/llvm/IR/ModuleSummaryIndex.h b/contrib/llvm-project/llvm/include/llvm/IR/ModuleSummaryIndex.h index ec1d5ef79eed..b76bc879fb45 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/ModuleSummaryIndex.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/ModuleSummaryIndex.h @@ -22,7 +22,6 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/TinyPtrVector.h" #include "llvm/IR/ConstantRange.h" #include "llvm/IR/GlobalValue.h" #include "llvm/IR/Module.h" diff --git a/contrib/llvm-project/llvm/include/llvm/IR/PassInstrumentation.h b/contrib/llvm-project/llvm/include/llvm/IR/PassInstrumentation.h index 8e81f30b2289..27dd075bbdb2 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/PassInstrumentation.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/PassInstrumentation.h @@ -86,7 +86,7 @@ public: using AnalysesClearedFunc = void(StringRef); public: - PassInstrumentationCallbacks() {} + PassInstrumentationCallbacks() = default; /// Copying PassInstrumentationCallbacks is not intended. PassInstrumentationCallbacks(const PassInstrumentationCallbacks &) = delete; diff --git a/contrib/llvm-project/llvm/include/llvm/IR/PassManager.h b/contrib/llvm-project/llvm/include/llvm/IR/PassManager.h index e88d2233daba..12f9052a9edd 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/PassManager.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/PassManager.h @@ -46,11 +46,8 @@ #include "llvm/IR/Module.h" #include "llvm/IR/PassInstrumentation.h" #include "llvm/IR/PassManagerInternal.h" -#include "llvm/Pass.h" -#include "llvm/Support/Debug.h" #include "llvm/Support/TimeProfiler.h" #include "llvm/Support/TypeName.h" -#include <algorithm> #include <cassert> #include <cstring> #include <iterator> @@ -473,7 +470,7 @@ class PassManager : public PassInfoMixin< PassManager<IRUnitT, AnalysisManagerT, ExtraArgTs...>> { public: /// Construct a pass manager. - explicit PassManager() {} + explicit PassManager() = default; // FIXME: These are equivalent to the default move constructor/move // assignment. However, using = default triggers linker errors due to the diff --git a/contrib/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h b/contrib/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h index bb4fbe98b082..3c94cf2811f6 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h @@ -20,7 +20,7 @@ namespace llvm { template <typename IRUnitT, typename... ExtraArgTs> -inline AnalysisManager<IRUnitT, ExtraArgTs...>::AnalysisManager() {} +inline AnalysisManager<IRUnitT, ExtraArgTs...>::AnalysisManager() = default; template <typename IRUnitT, typename... ExtraArgTs> inline AnalysisManager<IRUnitT, ExtraArgTs...>::AnalysisManager( diff --git a/contrib/llvm-project/llvm/include/llvm/IR/PassTimingInfo.h b/contrib/llvm-project/llvm/include/llvm/IR/PassTimingInfo.h index e44321b4af66..49a83605c47a 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/PassTimingInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/PassTimingInfo.h @@ -15,8 +15,6 @@ #ifndef LLVM_IR_PASSTIMINGINFO_H #define LLVM_IR_PASSTIMINGINFO_H -#include "llvm/ADT/Any.h" -#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" diff --git a/contrib/llvm-project/llvm/include/llvm/IR/ReplaceConstant.h b/contrib/llvm-project/llvm/include/llvm/IR/ReplaceConstant.h index 5ad1d0a6f920..1d6b10d9a78b 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/ReplaceConstant.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/ReplaceConstant.h @@ -14,13 +14,16 @@ #ifndef LLVM_IR_REPLACECONSTANT_H #define LLVM_IR_REPLACECONSTANT_H -#include "llvm/IR/Constants.h" -#include "llvm/IR/Instruction.h" #include <map> #include <vector> namespace llvm { +class ConstantExpr; +class Instruction; +class Use; +template <typename PtrType> class SmallPtrSetImpl; + /// The given instruction \p I contains given constant expression \p CE as one /// of its operands, possibly nested within constant expression trees. Convert /// all reachable paths from contant expression operands of \p I to \p CE into diff --git a/contrib/llvm-project/llvm/include/llvm/IR/SSAContext.h b/contrib/llvm-project/llvm/include/llvm/IR/SSAContext.h index 8879512610c2..8ca23e3ee077 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/SSAContext.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/SSAContext.h @@ -15,18 +15,15 @@ #ifndef LLVM_IR_SSACONTEXT_H #define LLVM_IR_SSACONTEXT_H -#include "llvm/ADT/GenericSSAContext.h" -#include "llvm/IR/ModuleSlotTracker.h" #include "llvm/Support/Printable.h" -#include <memory> - namespace llvm { class BasicBlock; class Function; class Instruction; class Value; template <typename, bool> class DominatorTreeBase; +template <typename _FunctionT> class GenericSSAContext; template <> class GenericSSAContext<Function> { Function *F; diff --git a/contrib/llvm-project/llvm/include/llvm/IR/SafepointIRVerifier.h b/contrib/llvm-project/llvm/include/llvm/IR/SafepointIRVerifier.h index 76b147e690be..246d236adb38 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/SafepointIRVerifier.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/SafepointIRVerifier.h @@ -37,7 +37,7 @@ FunctionPass *createSafepointIRVerifierPass(); class SafepointIRVerifierPass : public PassInfoMixin<SafepointIRVerifierPass> { public: - explicit SafepointIRVerifierPass() {} + explicit SafepointIRVerifierPass() = default; PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); }; diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Statepoint.h b/contrib/llvm-project/llvm/include/llvm/IR/Statepoint.h index a254a67e6b1f..da9c732ad818 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/Statepoint.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/Statepoint.h @@ -19,10 +19,9 @@ #include "llvm/ADT/Optional.h" #include "llvm/ADT/iterator_range.h" #include "llvm/IR/Attributes.h" -#include "llvm/IR/BasicBlock.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" -#include "llvm/IR/Instruction.h" +#include "llvm/IR/InstrTypes.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Intrinsics.h" @@ -204,11 +203,6 @@ public: /// For example this could happen due to relocations on unwinding /// path of invoke. inline std::vector<const GCRelocateInst *> getGCRelocates() const; - - /// Returns pair of boolean flags. The first one is true is there is - /// a gc.result intrinsic in the same block as statepoint. The second flag - /// is true if there is an intrinsic outside of the block with statepoint. - inline std::pair<bool, bool> getGCResultLocality() const; }; std::vector<const GCRelocateInst *> GCStatepointInst::getGCRelocates() const { @@ -236,18 +230,6 @@ std::vector<const GCRelocateInst *> GCStatepointInst::getGCRelocates() const { return Result; } -std::pair<bool, bool> GCStatepointInst::getGCResultLocality() const { - std::pair<bool, bool> Res(false, false); - for (auto *U : users()) - if (auto *GRI = dyn_cast<GCResultInst>(U)) { - if (GRI->getParent() == this->getParent()) - Res.first = true; - else - Res.second = true; - } - return Res; -} - /// Call sites that get wrapped by a gc.statepoint (currently only in /// RewriteStatepointsForGC and potentially in other passes in the future) can /// have attributes that describe properties of gc.statepoint call they will be diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Type.h b/contrib/llvm-project/llvm/include/llvm/IR/Type.h index 98c97375ad7b..e4e8a5529c87 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/Type.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/Type.h @@ -15,7 +15,6 @@ #define LLVM_IR_TYPE_H #include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" @@ -33,6 +32,7 @@ class LLVMContext; class PointerType; class raw_ostream; class StringRef; +template <typename PtrType> class SmallPtrSetImpl; /// The instances of the Type class are immutable: once they are created, /// they are never changed. Also note that only one instance of a particular diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Use.h b/contrib/llvm-project/llvm/include/llvm/IR/Use.h index 917db2679c55..64b86f3a4396 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/Use.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/Use.h @@ -25,7 +25,6 @@ #define LLVM_IR_USE_H #include "llvm-c/Types.h" -#include "llvm/ADT/PointerIntPair.h" #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/Compiler.h" diff --git a/contrib/llvm-project/llvm/include/llvm/InterfaceStub/IFSStub.h b/contrib/llvm-project/llvm/include/llvm/InterfaceStub/IFSStub.h index 5b16b8304692..8c3cd171b1a2 100644 --- a/contrib/llvm-project/llvm/include/llvm/InterfaceStub/IFSStub.h +++ b/contrib/llvm-project/llvm/include/llvm/InterfaceStub/IFSStub.h @@ -95,7 +95,7 @@ struct IFSStub { std::vector<std::string> NeededLibs; std::vector<IFSSymbol> Symbols; - IFSStub() {} + IFSStub() = default; IFSStub(const IFSStub &Stub); IFSStub(IFSStub &&Stub); }; @@ -106,7 +106,7 @@ struct IFSStub { // This class makes it possible to map a second traits so the same data // structure can be used for 2 different yaml schema. struct IFSStubTriple : IFSStub { - IFSStubTriple() {} + IFSStubTriple() = default; IFSStubTriple(const IFSStub &Stub); IFSStubTriple(const IFSStubTriple &Stub); IFSStubTriple(IFSStubTriple &&Stub); diff --git a/contrib/llvm-project/llvm/include/llvm/LineEditor/LineEditor.h b/contrib/llvm-project/llvm/include/llvm/LineEditor/LineEditor.h index 0beaf1bb23a9..9f4ea5bee139 100644 --- a/contrib/llvm-project/llvm/include/llvm/LineEditor/LineEditor.h +++ b/contrib/llvm-project/llvm/include/llvm/LineEditor/LineEditor.h @@ -64,7 +64,7 @@ public: /// A possible completion at a given cursor position. struct Completion { - Completion() {} + Completion() = default; Completion(const std::string &TypedText, const std::string &DisplayText) : TypedText(TypedText), DisplayText(DisplayText) {} diff --git a/contrib/llvm-project/llvm/include/llvm/MC/MCContext.h b/contrib/llvm-project/llvm/include/llvm/MC/MCContext.h index 88d86d5b675a..d2307d692278 100644 --- a/contrib/llvm-project/llvm/include/llvm/MC/MCContext.h +++ b/contrib/llvm-project/llvm/include/llvm/MC/MCContext.h @@ -80,6 +80,10 @@ namespace llvm { private: Environment Env; + /// The name of the Segment where Swift5 Reflection Section data will be + /// outputted + StringRef Swift5ReflectionSegmentName; + /// The triple for this object. Triple TT; @@ -399,13 +403,17 @@ namespace llvm { const MCRegisterInfo *MRI, const MCSubtargetInfo *MSTI, const SourceMgr *Mgr = nullptr, MCTargetOptions const *TargetOpts = nullptr, - bool DoAutoReset = true); + bool DoAutoReset = true, + StringRef Swift5ReflSegmentName = {}); MCContext(const MCContext &) = delete; MCContext &operator=(const MCContext &) = delete; ~MCContext(); Environment getObjectFileType() const { return Env; } + const StringRef &getSwift5ReflectionSegmentName() const { + return Swift5ReflectionSegmentName; + } const Triple &getTargetTriple() const { return TT; } const SourceMgr *getSourceManager() const { return SrcMgr; } diff --git a/contrib/llvm-project/llvm/include/llvm/MC/MCObjectFileInfo.h b/contrib/llvm-project/llvm/include/llvm/MC/MCObjectFileInfo.h index 5e0cccaba77f..3c1d10c4e62f 100644 --- a/contrib/llvm-project/llvm/include/llvm/MC/MCObjectFileInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/MC/MCObjectFileInfo.h @@ -15,6 +15,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Triple.h" +#include "llvm/BinaryFormat/Swift.h" #include "llvm/MC/MCSymbol.h" #include "llvm/Support/CodeGen.h" #include "llvm/Support/VersionTuple.h" @@ -228,6 +229,10 @@ protected: MCSection *ReadOnly8Section = nullptr; MCSection *ReadOnly16Section = nullptr; + // Swift5 Reflection Data Sections + std::array<MCSection *, binaryformat::Swift5ReflectionSectionKind::last> + Swift5ReflectionSections = {}; + public: void initMCObjectFileInfo(MCContext &MCCtx, bool PIC, bool LargeCodeModel = false); @@ -423,6 +428,15 @@ public: bool isPositionIndependent() const { return PositionIndependent; } + // Swift5 Reflection Data Sections + MCSection *getSwift5ReflectionSection( + llvm::binaryformat::Swift5ReflectionSectionKind ReflSectionKind) { + return ReflSectionKind != + llvm::binaryformat::Swift5ReflectionSectionKind::unknown + ? Swift5ReflectionSections[ReflSectionKind] + : nullptr; + } + private: bool PositionIndependent = false; MCContext *Ctx = nullptr; diff --git a/contrib/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h b/contrib/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h index 17b7446baae8..9ff68f4236ca 100644 --- a/contrib/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h +++ b/contrib/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h @@ -268,7 +268,7 @@ public: // Used for decoding uint32_t ChildrenToProcess = 0; - MCDecodedPseudoProbeInlineTree(){}; + MCDecodedPseudoProbeInlineTree() = default; MCDecodedPseudoProbeInlineTree(const InlineSite &Site) : ISite(Site){}; // Return false if it's a dummy inline site diff --git a/contrib/llvm-project/llvm/include/llvm/MCA/CustomBehaviour.h b/contrib/llvm-project/llvm/include/llvm/MCA/CustomBehaviour.h index 5b993c6a5345..c4be5312ea19 100644 --- a/contrib/llvm-project/llvm/include/llvm/MCA/CustomBehaviour.h +++ b/contrib/llvm-project/llvm/include/llvm/MCA/CustomBehaviour.h @@ -41,7 +41,7 @@ public: InstrPostProcess(const MCSubtargetInfo &STI, const MCInstrInfo &MCII) : STI(STI), MCII(MCII) {} - virtual ~InstrPostProcess() {} + virtual ~InstrPostProcess() = default; /// This method can be overriden by targets to modify the mca::Instruction /// object after it has been lowered from the MCInst. diff --git a/contrib/llvm-project/llvm/include/llvm/MCA/HWEventListener.h b/contrib/llvm-project/llvm/include/llvm/MCA/HWEventListener.h index 5b5b83cccd9c..8298e0705d33 100644 --- a/contrib/llvm-project/llvm/include/llvm/MCA/HWEventListener.h +++ b/contrib/llvm-project/llvm/include/llvm/MCA/HWEventListener.h @@ -176,7 +176,7 @@ public: virtual void onReleasedBuffers(const InstRef &Inst, ArrayRef<unsigned> Buffers) {} - virtual ~HWEventListener() {} + virtual ~HWEventListener() = default; private: virtual void anchor(); diff --git a/contrib/llvm-project/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h b/contrib/llvm-project/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h index 7467fd6754f0..1c909b01a390 100644 --- a/contrib/llvm-project/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h +++ b/contrib/llvm-project/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h @@ -49,7 +49,7 @@ class ResourceStrategy { ResourceStrategy &operator=(const ResourceStrategy &) = delete; public: - ResourceStrategy() {} + ResourceStrategy() = default; virtual ~ResourceStrategy(); /// Selects a processor resource unit from a ReadyMask. diff --git a/contrib/llvm-project/llvm/include/llvm/Object/Archive.h b/contrib/llvm-project/llvm/include/llvm/Object/Archive.h index 5a5fc90f18bd..b792cbc3d9ac 100644 --- a/contrib/llvm-project/llvm/include/llvm/Object/Archive.h +++ b/contrib/llvm-project/llvm/include/llvm/Object/Archive.h @@ -45,7 +45,7 @@ protected: public: friend class Archive; virtual std::unique_ptr<AbstractArchiveMemberHeader> clone() const = 0; - virtual ~AbstractArchiveMemberHeader(){}; + virtual ~AbstractArchiveMemberHeader() = default; /// Get the name without looking up long names. virtual Expected<StringRef> getRawName() const = 0; diff --git a/contrib/llvm-project/llvm/include/llvm/Object/ELFTypes.h b/contrib/llvm-project/llvm/include/llvm/Object/ELFTypes.h index e59a63d93989..c674b80c814d 100644 --- a/contrib/llvm-project/llvm/include/llvm/Object/ELFTypes.h +++ b/contrib/llvm-project/llvm/include/llvm/Object/ELFTypes.h @@ -699,7 +699,7 @@ private: } } - Elf_Note_Iterator_Impl() {} + Elf_Note_Iterator_Impl() = default; explicit Elf_Note_Iterator_Impl(Error &Err) : Err(&Err) {} Elf_Note_Iterator_Impl(const uint8_t *Start, size_t Size, Error &Err) : RemainingSize(Size), Err(&Err) { diff --git a/contrib/llvm-project/llvm/include/llvm/Object/MachO.h b/contrib/llvm-project/llvm/include/llvm/Object/MachO.h index ede742c47f97..49a0706b84be 100644 --- a/contrib/llvm-project/llvm/include/llvm/Object/MachO.h +++ b/contrib/llvm-project/llvm/include/llvm/Object/MachO.h @@ -22,6 +22,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/ADT/iterator_range.h" #include "llvm/BinaryFormat/MachO.h" +#include "llvm/BinaryFormat/Swift.h" #include "llvm/MC/SubtargetFeature.h" #include "llvm/Object/Binary.h" #include "llvm/Object/ObjectFile.h" @@ -583,6 +584,9 @@ public: StringRef mapDebugSectionName(StringRef Name) const override; + llvm::binaryformat::Swift5ReflectionSectionKind + mapReflectionSectionNameToEnumValue(StringRef SectionName) const override; + bool hasPageZeroSegment() const { return HasPageZeroSegment; } static bool classof(const Binary *v) { diff --git a/contrib/llvm-project/llvm/include/llvm/Object/ObjectFile.h b/contrib/llvm-project/llvm/include/llvm/Object/ObjectFile.h index 12704b1fc88e..950c38a599d5 100644 --- a/contrib/llvm-project/llvm/include/llvm/Object/ObjectFile.h +++ b/contrib/llvm-project/llvm/include/llvm/Object/ObjectFile.h @@ -18,6 +18,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/ADT/iterator_range.h" #include "llvm/BinaryFormat/Magic.h" +#include "llvm/BinaryFormat/Swift.h" #include "llvm/Object/Binary.h" #include "llvm/Object/Error.h" #include "llvm/Object/SymbolicFile.h" @@ -290,6 +291,11 @@ protected: virtual void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl<char> &Result) const = 0; + virtual llvm::binaryformat::Swift5ReflectionSectionKind + mapReflectionSectionNameToEnumValue(StringRef SectionName) const { + return llvm::binaryformat::Swift5ReflectionSectionKind::unknown; + }; + Expected<uint64_t> getSymbolValue(DataRefImpl Symb) const; public: diff --git a/contrib/llvm-project/llvm/include/llvm/Passes/StandardInstrumentations.h b/contrib/llvm-project/llvm/include/llvm/Passes/StandardInstrumentations.h index 9eb754a4d824..561cd54fa998 100644 --- a/contrib/llvm-project/llvm/include/llvm/Passes/StandardInstrumentations.h +++ b/contrib/llvm-project/llvm/include/llvm/Passes/StandardInstrumentations.h @@ -75,7 +75,7 @@ private: class OptBisectInstrumentation { public: - OptBisectInstrumentation() {} + OptBisectInstrumentation() = default; void registerCallbacks(PassInstrumentationCallbacks &PIC); }; diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h index 4d3bb0e8ff10..a416eb28906e 100644 --- a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h +++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h @@ -16,6 +16,7 @@ #define LLVM_PROFILEDATA_INSTRPROF_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/BitmaskEnum.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" @@ -277,6 +278,18 @@ void createPGOFuncNameMetadata(Function &F, StringRef PGOFuncName); /// the duplicated profile variables for Comdat functions. bool needsComdatForCounter(const Function &F, const Module &M); +/// An enum describing the attributes of an instrumented profile. +enum class InstrProfKind { + Unknown = 0x0, + FE = 0x1, // A frontend clang profile, incompatible with other attrs. + IR = 0x2, // An IR-level profile (default when -fprofile-generate is used). + BB = 0x4, // A profile with entry basic block instrumentation. + CS = 0x8, // A context sensitive IR-level profile. + SingleByteCoverage = 0x10, // Use single byte probes for coverage. + FunctionEntryOnly = 0x20, // Only instrument the function entry basic block. + LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/FunctionEntryOnly) +}; + const std::error_category &instrprof_category(); enum class instrprof_error { @@ -1155,12 +1168,6 @@ struct Header { void getMemOPSizeRangeFromOption(StringRef Str, int64_t &RangeStart, int64_t &RangeLast); -// Create a COMDAT variable INSTR_PROF_RAW_VERSION_VAR to make the runtime -// aware this is an ir_level profile so it can set the version flag. -GlobalVariable *createIRLevelProfileFlagVar(Module &M, bool IsCS, - bool InstrEntryBBEnabled, - bool DebugInfoCorrelate); - // Create the variable for the profile file name. void createProfileFileNameVar(Module &M, StringRef InstrProfileOutput); diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfCorrelator.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfCorrelator.h index 135936b99f24..3d0076fd9035 100644 --- a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfCorrelator.h +++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfCorrelator.h @@ -55,7 +55,7 @@ public: enum InstrProfCorrelatorKind { CK_32Bit, CK_64Bit }; InstrProfCorrelatorKind getKind() const { return Kind; } - virtual ~InstrProfCorrelator() {} + virtual ~InstrProfCorrelator() = default; protected: struct Context { diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfData.inc b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfData.inc index 0544b6b2ef71..62054a6a3df5 100644 --- a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfData.inc +++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfData.inc @@ -660,6 +660,8 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure, * generated profile, and 0 if this is a Clang FE generated profile. * 1 in bit 57 indicates there are context-sensitive records in the profile. * The 59th bit indicates whether to use debug info to correlate profiles. + * The 60th bit indicates single byte coverage instrumentation. + * The 61st bit indicates function entry instrumentation only. */ #define VARIANT_MASKS_ALL 0xff00000000000000ULL #define GET_VERSION(V) ((V) & ~VARIANT_MASKS_ALL) @@ -667,6 +669,8 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure, #define VARIANT_MASK_CSIR_PROF (0x1ULL << 57) #define VARIANT_MASK_INSTR_ENTRY (0x1ULL << 58) #define VARIANT_MASK_DBG_CORRELATE (0x1ULL << 59) +#define VARIANT_MASK_BYTE_COVERAGE (0x1ULL << 60) +#define VARIANT_MASK_FUNCTION_ENTRY_ONLY (0x1ULL << 61) #define INSTR_PROF_RAW_VERSION_VAR __llvm_profile_raw_version #define INSTR_PROF_PROFILE_RUNTIME_VAR __llvm_profile_runtime #define INSTR_PROF_PROFILE_COUNTER_BIAS_VAR __llvm_profile_counter_bias diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfReader.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfReader.h index 1326cbf0e1ce..e9dd19a69792 100644 --- a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfReader.h +++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfReader.h @@ -100,6 +100,16 @@ public: /// Return true if we must provide debug info to create PGO profiles. virtual bool useDebugInfoCorrelate() const { return false; } + /// Return true if the profile has single byte counters representing coverage. + virtual bool hasSingleByteCoverage() const = 0; + + /// Return true if the profile only instruments function entries. + virtual bool functionEntryOnly() const = 0; + + /// Returns a BitsetEnum describing the attributes of the profile. To check + /// individual attributes prefer using the helpers above. + virtual InstrProfKind getProfileKind() const = 0; + /// Return the PGO symtab. There are three different readers: /// Raw, Text, and Indexed profile readers. The first two types /// of readers are used only by llvm-profdata tool, while the indexed @@ -176,9 +186,8 @@ private: std::unique_ptr<MemoryBuffer> DataBuffer; /// Iterator over the profile data. line_iterator Line; - bool IsIRLevelProfile = false; - bool HasCSIRLevelProfile = false; - bool InstrEntryBBEnabled = false; + /// The attributes of the current profile. + InstrProfKind ProfileKind = InstrProfKind::Unknown; Error readValueProfileData(InstrProfRecord &Record); @@ -191,11 +200,27 @@ public: /// Return true if the given buffer is in text instrprof format. static bool hasFormat(const MemoryBuffer &Buffer); - bool isIRLevelProfile() const override { return IsIRLevelProfile; } + bool isIRLevelProfile() const override { + return static_cast<bool>(ProfileKind & InstrProfKind::IR); + } - bool hasCSIRLevelProfile() const override { return HasCSIRLevelProfile; } + bool hasCSIRLevelProfile() const override { + return static_cast<bool>(ProfileKind & InstrProfKind::CS); + } - bool instrEntryBBEnabled() const override { return InstrEntryBBEnabled; } + bool instrEntryBBEnabled() const override { + return static_cast<bool>(ProfileKind & InstrProfKind::BB); + } + + bool hasSingleByteCoverage() const override { + return static_cast<bool>(ProfileKind & InstrProfKind::SingleByteCoverage); + } + + bool functionEntryOnly() const override { + return static_cast<bool>(ProfileKind & InstrProfKind::FunctionEntryOnly); + } + + InstrProfKind getProfileKind() const override { return ProfileKind; } /// Read the header. Error readHeader() override; @@ -276,6 +301,17 @@ public: return (Version & VARIANT_MASK_DBG_CORRELATE) != 0; } + bool hasSingleByteCoverage() const override { + return (Version & VARIANT_MASK_BYTE_COVERAGE) != 0; + } + + bool functionEntryOnly() const override { + return (Version & VARIANT_MASK_FUNCTION_ENTRY_ONLY) != 0; + } + + /// Returns a BitsetEnum describing the attributes of the raw instr profile. + InstrProfKind getProfileKind() const override; + InstrProfSymtab &getSymtab() override { assert(Symtab.get()); return *Symtab.get(); @@ -333,7 +369,9 @@ private: return Symtab->getFuncName(swap(NameRef)); } - int getCounterTypeSize() const { return sizeof(uint64_t); } + int getCounterTypeSize() const { + return hasSingleByteCoverage() ? sizeof(uint8_t) : sizeof(uint64_t); + } }; using RawInstrProfReader32 = RawInstrProfReader<uint32_t>; @@ -413,6 +451,9 @@ struct InstrProfReaderIndexBase { virtual bool isIRLevelProfile() const = 0; virtual bool hasCSIRLevelProfile() const = 0; virtual bool instrEntryBBEnabled() const = 0; + virtual bool hasSingleByteCoverage() const = 0; + virtual bool functionEntryOnly() const = 0; + virtual InstrProfKind getProfileKind() const = 0; virtual Error populateSymtab(InstrProfSymtab &) = 0; }; @@ -465,6 +506,16 @@ public: return (FormatVersion & VARIANT_MASK_INSTR_ENTRY) != 0; } + bool hasSingleByteCoverage() const override { + return (FormatVersion & VARIANT_MASK_BYTE_COVERAGE) != 0; + } + + bool functionEntryOnly() const override { + return (FormatVersion & VARIANT_MASK_FUNCTION_ENTRY_ONLY) != 0; + } + + InstrProfKind getProfileKind() const override; + Error populateSymtab(InstrProfSymtab &Symtab) override { return Symtab.create(HashTable->keys()); } @@ -473,7 +524,7 @@ public: /// Name matcher supporting fuzzy matching of symbol names to names in profiles. class InstrProfReaderRemapper { public: - virtual ~InstrProfReaderRemapper() {} + virtual ~InstrProfReaderRemapper() = default; virtual Error populateRemappings() { return Error::success(); } virtual Error getRecords(StringRef FuncName, ArrayRef<NamedInstrProfRecord> &Data) = 0; @@ -523,6 +574,18 @@ public: return Index->instrEntryBBEnabled(); } + bool hasSingleByteCoverage() const override { + return Index->hasSingleByteCoverage(); + } + + bool functionEntryOnly() const override { return Index->functionEntryOnly(); } + + /// Returns a BitsetEnum describing the attributes of the indexed instr + /// profile. + InstrProfKind getProfileKind() const override { + return Index->getProfileKind(); + } + /// Return true if the given buffer is in an indexed instrprof format. static bool hasFormat(const MemoryBuffer &DataBuffer); diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfWriter.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfWriter.h index 97c80de6aa23..af1e46cf4fc2 100644 --- a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfWriter.h +++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProfWriter.h @@ -33,19 +33,17 @@ class raw_fd_ostream; class InstrProfWriter { public: using ProfilingData = SmallDenseMap<uint64_t, InstrProfRecord>; - // PF_IRLevelWithCS is the profile from context sensitive IR instrumentation. - enum ProfKind { PF_Unknown = 0, PF_FE, PF_IRLevel, PF_IRLevelWithCS }; private: bool Sparse; StringMap<ProfilingData> FunctionData; - ProfKind ProfileKind = PF_Unknown; - bool InstrEntryBBEnabled; + // An enum describing the attributes of the profile. + InstrProfKind ProfileKind = InstrProfKind::Unknown; // Use raw pointer here for the incomplete type object. InstrProfRecordWriterTrait *InfoObj; public: - InstrProfWriter(bool Sparse = false, bool InstrEntryBBEnabled = false); + InstrProfWriter(bool Sparse = false); ~InstrProfWriter(); StringMap<ProfilingData> &getProfileData() { return FunctionData; } @@ -79,30 +77,41 @@ public: /// Write the profile, returning the raw data. For testing. std::unique_ptr<MemoryBuffer> writeBuffer(); - /// Set the ProfileKind. Report error if mixing FE and IR level profiles. - /// \c WithCS indicates if this is for contenxt sensitive instrumentation. - Error setIsIRLevelProfile(bool IsIRLevel, bool WithCS) { - if (ProfileKind == PF_Unknown) { - if (IsIRLevel) - ProfileKind = WithCS ? PF_IRLevelWithCS : PF_IRLevel; - else - ProfileKind = PF_FE; + /// Update the attributes of the current profile from the attributes + /// specified. An error is returned if IR and FE profiles are mixed. + Error mergeProfileKind(const InstrProfKind Other) { + // If the kind is unset, this is the first profile we are merging so just + // set it to the given type. + if (ProfileKind == InstrProfKind::Unknown) { + ProfileKind = Other; return Error::success(); } - if (((ProfileKind != PF_FE) && !IsIRLevel) || - ((ProfileKind == PF_FE) && IsIRLevel)) + // Returns true if merging is should fail assuming A and B are incompatible. + auto testIncompatible = [&](InstrProfKind A, InstrProfKind B) { + return (static_cast<bool>(ProfileKind & A) && + static_cast<bool>(Other & B)) || + (static_cast<bool>(ProfileKind & B) && + static_cast<bool>(Other & A)); + }; + + // Check if the profiles are in-compatible. Clang frontend profiles can't be + // merged with other profile types. + if (static_cast<bool>((ProfileKind & InstrProfKind::FE) ^ + (Other & InstrProfKind::FE))) { return make_error<InstrProfError>(instrprof_error::unsupported_version); + } + if (testIncompatible(InstrProfKind::FunctionEntryOnly, InstrProfKind::BB)) { + return make_error<InstrProfError>( + instrprof_error::unsupported_version, + "cannot merge FunctionEntryOnly profiles and BB profiles together"); + } - // When merging a context-sensitive profile (WithCS == true) with an IRLevel - // profile, set the kind to PF_IRLevelWithCS. - if (ProfileKind == PF_IRLevel && WithCS) - ProfileKind = PF_IRLevelWithCS; - + // Now we update the profile type with the bits that are set. + ProfileKind |= Other; return Error::success(); } - void setInstrEntryBBEnabled(bool Enabled) { InstrEntryBBEnabled = Enabled; } // Internal interface for testing purpose only. void setValueProfDataEndianness(support::endianness Endianness); void setOutputSparse(bool Sparse); diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/MemProfData.inc b/contrib/llvm-project/llvm/include/llvm/ProfileData/MemProfData.inc index f2cb3738f053..ff22a697965c 100644 --- a/contrib/llvm-project/llvm/include/llvm/ProfileData/MemProfData.inc +++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/MemProfData.inc @@ -20,11 +20,10 @@ * \*===----------------------------------------------------------------------===*/ - #ifdef _MSC_VER -#define PACKED(__decl__) __pragma(pack(push,1)) __decl__ __pragma(pack(pop)) +#define PACKED(...) __pragma(pack(push,1)) __VA_ARGS__ __pragma(pack(pop)) #else -#define PACKED(__decl__) __decl__ __attribute__((__packed__)) +#define PACKED(...) __VA_ARGS__ __attribute__((__packed__)) #endif // A 64-bit magic number to uniquely identify the raw binary memprof profile file. @@ -47,14 +46,106 @@ PACKED(struct Header { uint64_t StackOffset; }); + // A struct describing the information necessary to describe a /proc/maps // segment entry for a particular binary/library identified by its build id. PACKED(struct SegmentEntry { uint64_t Start; uint64_t End; uint64_t Offset; - uint8_t BuildId[32]; + // This field is unused until sanitizer procmaps support for build ids for + // Linux-Elf is implemented. + uint8_t BuildId[32] = {0}; + + SegmentEntry(uint64_t S, uint64_t E, uint64_t O) : + Start(S), End(E), Offset(O) {} + + SegmentEntry(const SegmentEntry& S) { + Start = S.Start; + End = S.End; + Offset = S.Offset; + } + + SegmentEntry& operator=(const SegmentEntry& S) { + Start = S.Start; + End = S.End; + Offset = S.Offset; + return *this; + } + + bool operator==(const SegmentEntry& S) const { + return Start == S.Start && + End == S.End && + Offset == S.Offset; + } }); + +// A struct representing the heap allocation characteristics of a particular +// runtime context. This struct is shared between the compiler-rt runtime and +// the raw profile reader. The indexed format uses a separate, self-describing +// backwards compatible format. +PACKED(struct MemInfoBlock { + uint32_t alloc_count; + uint64_t total_access_count, min_access_count, max_access_count; + uint64_t total_size; + uint32_t min_size, max_size; + uint32_t alloc_timestamp, dealloc_timestamp; + uint64_t total_lifetime; + uint32_t min_lifetime, max_lifetime; + uint32_t alloc_cpu_id, dealloc_cpu_id; + uint32_t num_migrated_cpu; + + // Only compared to prior deallocated object currently. + uint32_t num_lifetime_overlaps; + uint32_t num_same_alloc_cpu; + uint32_t num_same_dealloc_cpu; + + uint64_t data_type_id; // TODO: hash of type name + + MemInfoBlock() : alloc_count(0) {} + + MemInfoBlock(uint32_t size, uint64_t access_count, uint32_t alloc_timestamp, + uint32_t dealloc_timestamp, uint32_t alloc_cpu, uint32_t dealloc_cpu) + : alloc_count(1), total_access_count(access_count), + min_access_count(access_count), max_access_count(access_count), + total_size(size), min_size(size), max_size(size), + alloc_timestamp(alloc_timestamp), dealloc_timestamp(dealloc_timestamp), + total_lifetime(dealloc_timestamp - alloc_timestamp), + min_lifetime(total_lifetime), max_lifetime(total_lifetime), + alloc_cpu_id(alloc_cpu), dealloc_cpu_id(dealloc_cpu), + num_lifetime_overlaps(0), num_same_alloc_cpu(0), + num_same_dealloc_cpu(0) { + num_migrated_cpu = alloc_cpu_id != dealloc_cpu_id; + } + + void Merge(const MemInfoBlock &newMIB) { + alloc_count += newMIB.alloc_count; + + total_access_count += newMIB.total_access_count; + min_access_count = newMIB.min_access_count < min_access_count ? newMIB.min_access_count : min_access_count; + max_access_count = newMIB.max_access_count < max_access_count ? newMIB.max_access_count : max_access_count; + + total_size += newMIB.total_size; + min_size = newMIB.min_size < min_size ? newMIB.min_size : min_size; + max_size = newMIB.max_size < max_size ? newMIB.max_size : max_size; + + total_lifetime += newMIB.total_lifetime; + min_lifetime = newMIB.min_lifetime < min_lifetime ? newMIB.min_lifetime : min_lifetime; + max_lifetime = newMIB.max_lifetime > max_lifetime ? newMIB.max_lifetime : max_lifetime; + + // We know newMIB was deallocated later, so just need to check if it was + // allocated before last one deallocated. + num_lifetime_overlaps += newMIB.alloc_timestamp < dealloc_timestamp; + alloc_timestamp = newMIB.alloc_timestamp; + dealloc_timestamp = newMIB.dealloc_timestamp; + + num_same_alloc_cpu += alloc_cpu_id == newMIB.alloc_cpu_id; + num_same_dealloc_cpu += dealloc_cpu_id == newMIB.dealloc_cpu_id; + alloc_cpu_id = newMIB.alloc_cpu_id; + dealloc_cpu_id = newMIB.dealloc_cpu_id; + } +}); + } // namespace memprof } // namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h b/contrib/llvm-project/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h index 645a8b3c0b17..19080c0132e3 100644 --- a/contrib/llvm-project/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h +++ b/contrib/llvm-project/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h @@ -17,11 +17,12 @@ #include "llvm/Bitstream/BitstreamWriter.h" #include "llvm/Remarks/BitstreamRemarkContainer.h" #include "llvm/Remarks/RemarkSerializer.h" -#include "llvm/Support/raw_ostream.h" namespace llvm { namespace remarks { +struct Remarks; + /// Serialize the remarks to LLVM bitstream. /// This class provides ways to emit remarks in the LLVM bitstream format and /// its associated metadata. diff --git a/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkLinker.h b/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkLinker.h index 49fd880be8ba..79d74e39deee 100644 --- a/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkLinker.h +++ b/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkLinker.h @@ -13,7 +13,6 @@ #ifndef LLVM_REMARKS_REMARKLINKER_H #define LLVM_REMARKS_REMARKLINKER_H -#include "llvm/Object/ObjectFile.h" #include "llvm/Remarks/Remark.h" #include "llvm/Remarks/RemarkFormat.h" #include "llvm/Remarks/RemarkStringTable.h" @@ -22,6 +21,11 @@ #include <set> namespace llvm { + +namespace object { +class ObjectFile; +} + namespace remarks { struct RemarkLinker { diff --git a/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkParser.h b/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkParser.h index b838f75e530f..61dfdbf3c17c 100644 --- a/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkParser.h +++ b/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkParser.h @@ -13,9 +13,7 @@ #ifndef LLVM_REMARKS_REMARKPARSER_H #define LLVM_REMARKS_REMARKPARSER_H -#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Remarks/Remark.h" #include "llvm/Remarks/RemarkFormat.h" #include "llvm/Support/Error.h" #include <memory> @@ -23,11 +21,13 @@ namespace llvm { namespace remarks { +struct Remark; + class EndOfFileError : public ErrorInfo<EndOfFileError> { public: static char ID; - EndOfFileError() {} + EndOfFileError() = default; void log(raw_ostream &OS) const override { OS << "End of file reached."; } std::error_code convertToErrorCode() const override { diff --git a/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkSerializer.h b/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkSerializer.h index 90e556df87e7..6217bd98d1a5 100644 --- a/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkSerializer.h +++ b/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkSerializer.h @@ -16,11 +16,15 @@ #include "llvm/Remarks/Remark.h" #include "llvm/Remarks/RemarkFormat.h" #include "llvm/Remarks/RemarkStringTable.h" -#include "llvm/Support/raw_ostream.h" namespace llvm { + +class raw_ostream; + namespace remarks { +struct Remark; + enum class SerializerMode { Separate, // A mode where the metadata is serialized separately from the // remarks. Typically, this is used when the remarks need to be diff --git a/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkStreamer.h b/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkStreamer.h index 7741cb45b72c..b25cb0c331a4 100644 --- a/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkStreamer.h +++ b/contrib/llvm-project/llvm/include/llvm/Remarks/RemarkStreamer.h @@ -34,10 +34,12 @@ #include "llvm/Remarks/RemarkSerializer.h" #include "llvm/Support/Error.h" #include "llvm/Support/Regex.h" -#include "llvm/Support/raw_ostream.h" #include <memory> namespace llvm { + +class raw_ostream; + namespace remarks { class RemarkStreamer final { /// The regex used to filter remarks based on the passes that emit them. diff --git a/contrib/llvm-project/llvm/include/llvm/Support/AArch64TargetParser.def b/contrib/llvm-project/llvm/include/llvm/Support/AArch64TargetParser.def index 26f4bae53119..a953e9439db4 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/AArch64TargetParser.def +++ b/contrib/llvm-project/llvm/include/llvm/Support/AArch64TargetParser.def @@ -204,6 +204,9 @@ AARCH64_CPU_NAME("cortex-r82", ARMV8R, FK_CRYPTO_NEON_FP_ARMV8, false, AARCH64_CPU_NAME("cortex-x1", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false, (AArch64::AEK_FP16 | AArch64::AEK_DOTPROD | AArch64::AEK_RCPC | AArch64::AEK_SSBS)) +AARCH64_CPU_NAME("cortex-x1c", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false, + (AArch64::AEK_FP16 | AArch64::AEK_DOTPROD | AArch64::AEK_RCPC | + AArch64::AEK_SSBS | AArch64::AEK_PAUTH)) AARCH64_CPU_NAME("cortex-x2", ARMV9A, FK_NEON_FP_ARMV8, false, (AArch64::AEK_MTE | AArch64::AEK_BF16 | AArch64::AEK_I8MM | AArch64::AEK_PAUTH | AArch64::AEK_SSBS | AArch64::AEK_SB | diff --git a/contrib/llvm-project/llvm/include/llvm/Support/AMDGPUMetadata.h b/contrib/llvm-project/llvm/include/llvm/Support/AMDGPUMetadata.h index 784a980fee24..e0838a1f425e 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/AMDGPUMetadata.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/AMDGPUMetadata.h @@ -44,6 +44,11 @@ constexpr uint32_t VersionMajorV4 = 1; /// HSA metadata minor version for code object V4. constexpr uint32_t VersionMinorV4 = 1; +/// HSA metadata major version for code object V5. +constexpr uint32_t VersionMajorV5 = 1; +/// HSA metadata minor version for code object V5. +constexpr uint32_t VersionMinorV5 = 2; + /// HSA metadata beginning assembler directive. constexpr char AssemblerDirectiveBegin[] = ".amd_amdgpu_hsa_metadata"; /// HSA metadata ending assembler directive. diff --git a/contrib/llvm-project/llvm/include/llvm/Support/ARMTargetParser.def b/contrib/llvm-project/llvm/include/llvm/Support/ARMTargetParser.def index 433d7fdc2c3b..80deeb2a6e9d 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/ARMTargetParser.def +++ b/contrib/llvm-project/llvm/include/llvm/Support/ARMTargetParser.def @@ -328,6 +328,8 @@ ARM_CPU_NAME("cortex-a710", ARMV9A, FK_NEON_FP_ARMV8, false, ARM::AEK_I8MM)) ARM_CPU_NAME("cortex-x1", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false, (ARM::AEK_FP16 | ARM::AEK_DOTPROD)) +ARM_CPU_NAME("cortex-x1c", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false, + (ARM::AEK_FP16 | ARM::AEK_DOTPROD)) ARM_CPU_NAME("neoverse-n1", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false, (ARM::AEK_FP16 | ARM::AEK_DOTPROD)) ARM_CPU_NAME("neoverse-n2", ARMV8_5A, FK_CRYPTO_NEON_FP_ARMV8, false, diff --git a/contrib/llvm-project/llvm/include/llvm/Support/BinaryStreamReader.h b/contrib/llvm-project/llvm/include/llvm/Support/BinaryStreamReader.h index c664ac48daad..6853df3ccab1 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/BinaryStreamReader.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/BinaryStreamReader.h @@ -35,16 +35,11 @@ public: llvm::support::endianness Endian); explicit BinaryStreamReader(StringRef Data, llvm::support::endianness Endian); - BinaryStreamReader(const BinaryStreamReader &Other) - : Stream(Other.Stream), Offset(Other.Offset) {} + BinaryStreamReader(const BinaryStreamReader &Other) = default; - BinaryStreamReader &operator=(const BinaryStreamReader &Other) { - Stream = Other.Stream; - Offset = Other.Offset; - return *this; - } + BinaryStreamReader &operator=(const BinaryStreamReader &Other) = default; - virtual ~BinaryStreamReader() {} + virtual ~BinaryStreamReader() = default; /// Read as much as possible from the underlying string at the current offset /// without invoking a copy, and set \p Buffer to the resulting data slice. diff --git a/contrib/llvm-project/llvm/include/llvm/Support/BinaryStreamWriter.h b/contrib/llvm-project/llvm/include/llvm/Support/BinaryStreamWriter.h index c05b0420aaa3..ce7af3650f52 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/BinaryStreamWriter.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/BinaryStreamWriter.h @@ -35,16 +35,11 @@ public: explicit BinaryStreamWriter(MutableArrayRef<uint8_t> Data, llvm::support::endianness Endian); - BinaryStreamWriter(const BinaryStreamWriter &Other) - : Stream(Other.Stream), Offset(Other.Offset) {} + BinaryStreamWriter(const BinaryStreamWriter &Other) = default; - BinaryStreamWriter &operator=(const BinaryStreamWriter &Other) { - Stream = Other.Stream; - Offset = Other.Offset; - return *this; - } + BinaryStreamWriter &operator=(const BinaryStreamWriter &Other) = default; - virtual ~BinaryStreamWriter() {} + virtual ~BinaryStreamWriter() = default; /// Write the bytes specified in \p Buffer to the underlying stream. /// On success, updates the offset so that subsequent writes will occur diff --git a/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h b/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h index 120ab1840915..c8e29ac42559 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h @@ -877,7 +877,7 @@ class basic_parser_impl { // non-template implementation of basic_parser<t> public: basic_parser_impl(Option &) {} - virtual ~basic_parser_impl() {} + virtual ~basic_parser_impl() = default; enum ValueExpected getValueExpectedFlagDefault() const { return ValueRequired; diff --git a/contrib/llvm-project/llvm/include/llvm/Support/Compiler.h b/contrib/llvm-project/llvm/include/llvm/Support/Compiler.h index f4c277fae7cc..f3317049524f 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/Compiler.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/Compiler.h @@ -77,12 +77,21 @@ /// * 1916: VS2017, version 15.9 /// * 1920: VS2019, version 16.0 /// * 1921: VS2019, version 16.1 +/// * 1922: VS2019, version 16.2 +/// * 1923: VS2019, version 16.3 +/// * 1924: VS2019, version 16.4 +/// * 1925: VS2019, version 16.5 +/// * 1926: VS2019, version 16.6 +/// * 1927: VS2019, version 16.7 +/// * 1928: VS2019, version 16.8 + 16.9 +/// * 1929: VS2019, version 16.10 + 16.11 +/// * 1930: VS2022, version 17.0 #ifdef _MSC_VER #define LLVM_MSC_PREREQ(version) (_MSC_VER >= (version)) -// We require at least MSVC 2017. -#if !LLVM_MSC_PREREQ(1910) -#error LLVM requires at least MSVC 2017. +// We require at least VS 2019. +#if !LLVM_MSC_PREREQ(1920) +#error LLVM requires at least VS 2019. #endif #else @@ -94,12 +103,8 @@ /// Sadly, this is separate from just rvalue reference support because GCC /// and MSVC implemented this later than everything else. This appears to be /// corrected in MSVC 2019 but not MSVC 2017. -#if __has_feature(cxx_rvalue_references) || defined(__GNUC__) || \ - LLVM_MSC_PREREQ(1920) +/// FIXME: Remove LLVM_HAS_RVALUE_REFERENCE_THIS macro #define LLVM_HAS_RVALUE_REFERENCE_THIS 1 -#else -#define LLVM_HAS_RVALUE_REFERENCE_THIS 0 -#endif /// Expands to '&' if ref-qualifiers for *this are supported. /// diff --git a/contrib/llvm-project/llvm/include/llvm/Support/FileOutputBuffer.h b/contrib/llvm-project/llvm/include/llvm/Support/FileOutputBuffer.h index 17b44380e9cd..d4b73522115d 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/FileOutputBuffer.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/FileOutputBuffer.h @@ -70,7 +70,7 @@ public: /// If this object was previously committed, the destructor just deletes /// this object. If this object was not committed, the destructor /// deallocates the buffer and the target file is never written. - virtual ~FileOutputBuffer() {} + virtual ~FileOutputBuffer() = default; /// This removes the temporary file (unless it already was committed) /// but keeps the memory mapping alive. diff --git a/contrib/llvm-project/llvm/include/llvm/Support/FormatVariadicDetails.h b/contrib/llvm-project/llvm/include/llvm/Support/FormatVariadicDetails.h index 2cafc120c1d7..2204cff13a64 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/FormatVariadicDetails.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/FormatVariadicDetails.h @@ -24,7 +24,7 @@ class format_adapter { virtual void anchor(); protected: - virtual ~format_adapter() {} + virtual ~format_adapter() = default; public: virtual void format(raw_ostream &S, StringRef Options) = 0; diff --git a/contrib/llvm-project/llvm/include/llvm/Support/GenericDomTree.h b/contrib/llvm-project/llvm/include/llvm/Support/GenericDomTree.h index f39400c26eab..d7c64bf62c7a 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/GenericDomTree.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/GenericDomTree.h @@ -260,7 +260,7 @@ protected: friend struct DomTreeBuilder::SemiNCAInfo<DominatorTreeBase>; public: - DominatorTreeBase() {} + DominatorTreeBase() = default; DominatorTreeBase(DominatorTreeBase &&Arg) : Roots(std::move(Arg.Roots)), diff --git a/contrib/llvm-project/llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h b/contrib/llvm-project/llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h index 3bafeb48f64a..96105d6b4684 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h @@ -37,7 +37,7 @@ namespace IDFCalculatorDetail { /// May be specialized if, for example, one wouldn't like to return nullpointer /// successors. template <class NodeTy, bool IsPostDom> struct ChildrenGetterTy { - using NodeRef = typename GraphTraits<NodeTy>::NodeRef; + using NodeRef = typename GraphTraits<NodeTy *>::NodeRef; using ChildrenTy = SmallVector<NodeRef, 8>; ChildrenTy get(const NodeRef &N); diff --git a/contrib/llvm-project/llvm/include/llvm/Support/KnownBits.h b/contrib/llvm-project/llvm/include/llvm/Support/KnownBits.h index 5ef0ba31f785..96b7753e9b20 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/KnownBits.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/KnownBits.h @@ -31,7 +31,7 @@ private: public: // Default construct Zero and One. - KnownBits() {} + KnownBits() = default; /// Create a known bits object of BitWidth bits initialized to unknown. KnownBits(unsigned BitWidth) : Zero(BitWidth, 0), One(BitWidth, 0) {} diff --git a/contrib/llvm-project/llvm/include/llvm/Support/RISCVISAInfo.h b/contrib/llvm-project/llvm/include/llvm/Support/RISCVISAInfo.h index b450c1df3558..7fa0e6ee3acf 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/RISCVISAInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/RISCVISAInfo.h @@ -92,6 +92,9 @@ private: void updateFLen(); void updateMinVLen(); void updateMaxELen(); + + static llvm::Expected<std::unique_ptr<RISCVISAInfo>> + postProcessAndChecking(std::unique_ptr<RISCVISAInfo> &&ISAInfo); }; } // namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h b/contrib/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h index 9bde4f455a2d..6b5daf710c9f 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h @@ -115,7 +115,7 @@ public: return SP->getKind() == ScopedPrinterKind::Base; } - virtual ~ScopedPrinter() {} + virtual ~ScopedPrinter() = default; void flush() { OS.flush(); } @@ -792,13 +792,13 @@ private: struct DelimitedScope { DelimitedScope(ScopedPrinter &W) : W(&W) {} DelimitedScope() : W(nullptr) {} - virtual ~DelimitedScope(){}; + virtual ~DelimitedScope() = default; virtual void setPrinter(ScopedPrinter &W) = 0; ScopedPrinter *W; }; struct DictScope : DelimitedScope { - explicit DictScope() {} + explicit DictScope() = default; explicit DictScope(ScopedPrinter &W) : DelimitedScope(W) { W.objectBegin(); } DictScope(ScopedPrinter &W, StringRef N) : DelimitedScope(W) { @@ -817,7 +817,7 @@ struct DictScope : DelimitedScope { }; struct ListScope : DelimitedScope { - explicit ListScope() {} + explicit ListScope() = default; explicit ListScope(ScopedPrinter &W) : DelimitedScope(W) { W.arrayBegin(); } ListScope(ScopedPrinter &W, StringRef N) : DelimitedScope(W) { diff --git a/contrib/llvm-project/llvm/include/llvm/Support/SuffixTree.h b/contrib/llvm-project/llvm/include/llvm/Support/SuffixTree.h index 352fba511937..162a1de72f1a 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/SuffixTree.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/SuffixTree.h @@ -109,7 +109,7 @@ struct SuffixTreeNode { SuffixTreeNode(unsigned StartIdx, unsigned *EndIdx, SuffixTreeNode *Link) : StartIdx(StartIdx), EndIdx(EndIdx), Link(Link) {} - SuffixTreeNode() {} + SuffixTreeNode() = default; }; /// A data structure for fast substring queries. diff --git a/contrib/llvm-project/llvm/include/llvm/Support/Timer.h b/contrib/llvm-project/llvm/include/llvm/Support/Timer.h index eb49e805b40d..742d20ce51dd 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/Timer.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/Timer.h @@ -106,7 +106,7 @@ public: ~Timer(); /// Create an uninitialized timer, client must use 'init'. - explicit Timer() {} + explicit Timer() = default; void init(StringRef TimerName, StringRef TimerDescription); void init(StringRef TimerName, StringRef TimerDescription, TimerGroup &tg); diff --git a/contrib/llvm-project/llvm/include/llvm/TableGen/Record.h b/contrib/llvm-project/llvm/include/llvm/TableGen/Record.h index add05bd078d6..1157487eced3 100644 --- a/contrib/llvm-project/llvm/include/llvm/TableGen/Record.h +++ b/contrib/llvm-project/llvm/include/llvm/TableGen/Record.h @@ -2015,7 +2015,7 @@ class Resolver { public: explicit Resolver(Record *CurRec) : CurRec(CurRec) {} - virtual ~Resolver() {} + virtual ~Resolver() = default; Record *getCurrentRecord() const { return CurRec; } diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h b/contrib/llvm-project/llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h index 03ead4bc0714..072ccf7320e8 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h @@ -18,6 +18,7 @@ #define LLVM_TRANSFORMS_AGGRESSIVEINSTCOMBINE_AGGRESSIVEINSTCOMBINE_H #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h index 6a208dfa6a25..78b2f909f1c9 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h @@ -15,6 +15,7 @@ #define LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h index 6d6cb58abdbb..225def99678a 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h @@ -27,14 +27,6 @@ class ArgumentPromotionPass : public PassInfoMixin<ArgumentPromotionPass> { public: ArgumentPromotionPass(unsigned MaxElements = 3u) : MaxElements(MaxElements) {} - /// Check if callers and the callee \p F agree how promoted arguments would be - /// passed. The ones that they do not agree on are eliminated from the sets but - /// the return value has to be observed as well. - static bool areFunctionArgsABICompatible( - const Function &F, const TargetTransformInfo &TTI, - SmallPtrSetImpl<Argument *> &ArgsToPromote, - SmallPtrSetImpl<Argument *> &ByValArgsToTransform); - /// Checks if a type could have padding bytes. static bool isDenselyPacked(Type *type, const DataLayout &DL); diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h index d56a43ec7961..7eee16f71d64 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -132,6 +132,7 @@ struct AbstractAttribute; struct InformationCache; struct AAIsDead; struct AttributorCallGraph; +struct IRPosition; class AAResults; class Function; @@ -139,6 +140,11 @@ class Function; /// Abstract Attribute helper functions. namespace AA { +/// Return true if \p I is a `nosync` instruction. Use generic reasoning and +/// potentially the corresponding AANoSync. +bool isNoSyncInst(Attributor &A, const Instruction &I, + const AbstractAttribute &QueryingAA); + /// Return true if \p V is dynamically unique, that is, there are no two /// "instances" of \p V at runtime with different values. bool isDynamicallyUnique(Attributor &A, const AbstractAttribute &QueryingAA, @@ -185,7 +191,8 @@ Constant *getInitialValueForObj(Value &Obj, Type &Ty, bool getAssumedUnderlyingObjects(Attributor &A, const Value &Ptr, SmallVectorImpl<Value *> &Objects, const AbstractAttribute &QueryingAA, - const Instruction *CtxI); + const Instruction *CtxI, + bool Intraprocedural = false); /// Collect all potential values of the one stored by \p SI into /// \p PotentialCopies. That is, the only copies that were made via the @@ -200,6 +207,34 @@ bool getPotentialCopiesOfStoredValue( Attributor &A, StoreInst &SI, SmallSetVector<Value *, 4> &PotentialCopies, const AbstractAttribute &QueryingAA, bool &UsedAssumedInformation); +/// Return true if \p IRP is readonly. This will query respective AAs that +/// deduce the information and introduce dependences for \p QueryingAA. +bool isAssumedReadOnly(Attributor &A, const IRPosition &IRP, + const AbstractAttribute &QueryingAA, bool &IsKnown); + +/// Return true if \p IRP is readnone. This will query respective AAs that +/// deduce the information and introduce dependences for \p QueryingAA. +bool isAssumedReadNone(Attributor &A, const IRPosition &IRP, + const AbstractAttribute &QueryingAA, bool &IsKnown); + +/// Return true if \p ToI is potentially reachable from \p FromI. The two +/// instructions do not need to be in the same function. \p GoBackwardsCB +/// can be provided to convey domain knowledge about the "lifespan" the user is +/// interested in. By default, the callers of \p FromI are checked as well to +/// determine if \p ToI can be reached. If the query is not interested in +/// callers beyond a certain point, e.g., a GPU kernel entry or the function +/// containing an alloca, the \p GoBackwardsCB should return false. +bool isPotentiallyReachable( + Attributor &A, const Instruction &FromI, const Instruction &ToI, + const AbstractAttribute &QueryingAA, + std::function<bool(const Function &F)> GoBackwardsCB = nullptr); + +/// Same as above but it is sufficient to reach any instruction in \p ToFn. +bool isPotentiallyReachable( + Attributor &A, const Instruction &FromI, const Function &ToFn, + const AbstractAttribute &QueryingAA, + std::function<bool(const Function &F)> GoBackwardsCB); + } // namespace AA /// The value passed to the line option that defines the maximal initialization @@ -227,7 +262,7 @@ enum class DepClassTy { /// The data structure for the nodes of a dependency graph struct AADepGraphNode { public: - virtual ~AADepGraphNode(){}; + virtual ~AADepGraphNode() = default; using DepTy = PointerIntPair<AADepGraphNode *, 1>; protected: @@ -266,8 +301,8 @@ public: /// then it means that B depends on A, and when the state of A is /// updated, node B should also be updated struct AADepGraph { - AADepGraph() {} - ~AADepGraph() {} + AADepGraph() = default; + ~AADepGraph() = default; using DepTy = AADepGraphNode::DepTy; static AADepGraphNode *DepGetVal(DepTy &DT) { return DT.getPointer(); } @@ -334,6 +369,14 @@ struct IRPosition { return IRPosition(const_cast<Value &>(V), IRP_FLOAT, CBContext); } + /// Create a position describing the instruction \p I. This is different from + /// the value version because call sites are treated as intrusctions rather + /// than their return value in this function. + static const IRPosition inst(const Instruction &I, + const CallBaseContext *CBContext = nullptr) { + return IRPosition(const_cast<Instruction &>(I), IRP_FLOAT, CBContext); + } + /// Create a position describing the function scope of \p F. /// \p CBContext is used for call base specific analysis. static const IRPosition function(const Function &F, @@ -662,7 +705,7 @@ private: break; case IRPosition::IRP_FLOAT: // Special case for floating functions. - if (isa<Function>(AnchorVal)) + if (isa<Function>(AnchorVal) || isa<CallBase>(AnchorVal)) Enc = {&AnchorVal, ENC_FLOATING_FUNCTION}; else Enc = {&AnchorVal, ENC_VALUE}; @@ -844,7 +887,7 @@ struct AnalysisGetter { } AnalysisGetter(FunctionAnalysisManager &FAM) : FAM(&FAM) {} - AnalysisGetter() {} + AnalysisGetter() = default; private: FunctionAnalysisManager *FAM = nullptr; @@ -879,7 +922,7 @@ struct InformationCache { [&](const Function &F) { return AG.getAnalysis<PostDominatorTreeAnalysis>(F); }), - AG(AG), CGSCC(CGSCC), TargetTriple(M.getTargetTriple()) { + AG(AG), TargetTriple(M.getTargetTriple()) { if (CGSCC) initializeModuleSlice(*CGSCC); } @@ -996,13 +1039,6 @@ struct InformationCache { return AG.getAnalysis<AP>(F); } - /// Return SCC size on call graph for function \p F or 0 if unknown. - unsigned getSccSize(const Function &F) { - if (CGSCC && CGSCC->count(const_cast<Function *>(&F))) - return CGSCC->size(); - return 0; - } - /// Return datalayout used in the module. const DataLayout &getDL() { return DL; } @@ -1092,9 +1128,6 @@ private: /// Getters for analysis. AnalysisGetter &AG; - /// The underlying CGSCC, or null if not available. - SetVector<Function *> *CGSCC; - /// Set of inlineable functions SmallPtrSet<const Function *, 8> InlineableFunctions; @@ -1362,6 +1395,9 @@ struct Attributor { return AA; } + /// Allows a query AA to request an update if a new query was received. + void registerForUpdate(AbstractAttribute &AA); + /// Explicitly record a dependence from \p FromAA to \p ToAA, that is if /// \p FromAA changes \p ToAA should be updated as well. /// @@ -1794,6 +1830,18 @@ public: const AbstractAttribute &QueryingAA, bool RequireAllCallSites, bool &AllCallSitesKnown); + /// Check \p Pred on all call sites of \p Fn. + /// + /// This method will evaluate \p Pred on call sites and return + /// true if \p Pred holds in every call sites. However, this is only possible + /// all call sites are known, hence the function has internal linkage. + /// If true is returned, \p AllCallSitesKnown is set if all possible call + /// sites of the function have been visited. + bool checkForAllCallSites(function_ref<bool(AbstractCallSite)> Pred, + const Function &Fn, bool RequireAllCallSites, + const AbstractAttribute *QueryingAA, + bool &AllCallSitesKnown); + /// Check \p Pred on all values potentially returned by \p F. /// /// This method will evaluate \p Pred on all values potentially returned by @@ -1932,18 +1980,6 @@ private: /// may trigger further updates. (\see DependenceStack) void rememberDependences(); - /// Check \p Pred on all call sites of \p Fn. - /// - /// This method will evaluate \p Pred on call sites and return - /// true if \p Pred holds in every call sites. However, this is only possible - /// all call sites are known, hence the function has internal linkage. - /// If true is returned, \p AllCallSitesKnown is set if all possible call - /// sites of the function have been visited. - bool checkForAllCallSites(function_ref<bool(AbstractCallSite)> Pred, - const Function &Fn, bool RequireAllCallSites, - const AbstractAttribute *QueryingAA, - bool &AllCallSitesKnown); - /// Determine if CallBase context in \p IRP should be propagated. bool shouldPropagateCallBaseContext(const IRPosition &IRP); @@ -2056,6 +2092,10 @@ private: /// Callback to get an OptimizationRemarkEmitter from a Function *. Optional<OptimizationRemarkGetter> OREGetter; + /// Container with all the query AAs that requested an update via + /// registerForUpdate. + SmallSetVector<AbstractAttribute *, 16> QueryAAsAwaitingUpdate; + /// The name of the pass to emit remarks for. const char *PassName = ""; @@ -2081,7 +2121,7 @@ private: /// additional methods to directly modify the state based if needed. See the /// class comments for help. struct AbstractState { - virtual ~AbstractState() {} + virtual ~AbstractState() = default; /// Return if this abstract state is in a valid state. If false, no /// information provided should be used. @@ -2122,7 +2162,7 @@ template <typename base_ty, base_ty BestState, base_ty WorstState> struct IntegerStateBase : public AbstractState { using base_t = base_ty; - IntegerStateBase() {} + IntegerStateBase() = default; IntegerStateBase(base_t Assumed) : Assumed(Assumed) {} /// Return the best possible representable state. @@ -2365,7 +2405,7 @@ struct BooleanState : public IntegerStateBase<bool, true, false> { using super = IntegerStateBase<bool, true, false>; using base_t = IntegerStateBase::base_t; - BooleanState() {} + BooleanState() = default; BooleanState(base_t Assumed) : super(Assumed) {} /// Set the assumed value to \p Value but never below the known one. @@ -2773,7 +2813,7 @@ struct AbstractAttribute : public IRPosition, public AADepGraphNode { AbstractAttribute(const IRPosition &IRP) : IRPosition(IRP) {} /// Virtual destructor. - virtual ~AbstractAttribute() {} + virtual ~AbstractAttribute() = default; /// This function is used to identify if an \p DGN is of type /// AbstractAttribute so that the dyn_cast and cast can use such information @@ -2793,6 +2833,14 @@ struct AbstractAttribute : public IRPosition, public AADepGraphNode { /// in the `updateImpl` method. virtual void initialize(Attributor &A) {} + /// A query AA is always scheduled as long as we do updates because it does + /// lazy computation that cannot be determined to be done from the outside. + /// However, while query AAs will not be fixed if they do not have outstanding + /// dependences, we will only schedule them like other AAs. If a query AA that + /// received a new query it needs to request an update via + /// `Attributor::requestUpdateForAA`. + virtual bool isQueryAA() const { return false; } + /// Return the internal abstract state for inspection. virtual StateType &getState() = 0; virtual const StateType &getState() const = 0; @@ -2989,6 +3037,14 @@ struct AANoSync /// Returns true if "nosync" is known. bool isKnownNoSync() const { return getKnown(); } + /// Helper function used to determine whether an instruction is non-relaxed + /// atomic. In other words, if an atomic instruction does not have unordered + /// or monotonic ordering + static bool isNonRelaxedAtomic(const Instruction *I); + + /// Helper function specific for intrinsics which are potentially volatile. + static bool isNoSyncIntrinsic(const Instruction *I); + /// Create an abstract attribute view for the position \p IRP. static AANoSync &createForPosition(const IRPosition &IRP, Attributor &A); @@ -4419,7 +4475,7 @@ private: struct AACallGraphNode { AACallGraphNode(Attributor &A) : A(A) {} - virtual ~AACallGraphNode() {} + virtual ~AACallGraphNode() = default; virtual AACallEdgeIterator optimisticEdgesBegin() const = 0; virtual AACallEdgeIterator optimisticEdgesEnd() const = 0; @@ -4485,7 +4541,7 @@ struct AACallEdges : public StateWrapper<BooleanState, AbstractAttribute>, // Synthetic root node for the Attributor's internal call graph. struct AttributorCallGraph : public AACallGraphNode { AttributorCallGraph(Attributor &A) : AACallGraphNode(A) {} - virtual ~AttributorCallGraph() {} + virtual ~AttributorCallGraph() = default; AACallEdgeIterator optimisticEdgesBegin() const override { return AACallEdgeIterator(A, A.Functions.begin()); @@ -4592,18 +4648,30 @@ struct AAFunctionReachability AAFunctionReachability(const IRPosition &IRP, Attributor &A) : Base(IRP) {} + /// See AbstractAttribute::isQueryAA. + bool isQueryAA() const override { return true; } + /// If the function represented by this possition can reach \p Fn. - virtual bool canReach(Attributor &A, Function *Fn) const = 0; + virtual bool canReach(Attributor &A, const Function &Fn) const = 0; + + /// Can \p CB reach \p Fn. + virtual bool canReach(Attributor &A, CallBase &CB, + const Function &Fn) const = 0; - /// Can \p CB reach \p Fn - virtual bool canReach(Attributor &A, CallBase &CB, Function *Fn) const = 0; + /// Can \p Inst reach \p Fn. + /// See also AA::isPotentiallyReachable. + virtual bool instructionCanReach(Attributor &A, const Instruction &Inst, + const Function &Fn, + bool UseBackwards = true) const = 0; /// Create an abstract attribute view for the position \p IRP. static AAFunctionReachability &createForPosition(const IRPosition &IRP, Attributor &A); /// See AbstractAttribute::getName() - const std::string getName() const override { return "AAFuncitonReacability"; } + const std::string getName() const override { + return "AAFunctionReachability"; + } /// See AbstractAttribute::getIdAddr() const char *getIdAddr() const override { return &ID; } @@ -4639,21 +4707,12 @@ struct AAPointerInfo : public AbstractAttribute { AccessKind Kind, Type *Ty) : LocalI(LocalI), RemoteI(RemoteI), Content(Content), Kind(Kind), Ty(Ty) {} - Access(const Access &Other) - : LocalI(Other.LocalI), RemoteI(Other.RemoteI), Content(Other.Content), - Kind(Other.Kind), Ty(Other.Ty) {} + Access(const Access &Other) = default; Access(const Access &&Other) : LocalI(Other.LocalI), RemoteI(Other.RemoteI), Content(Other.Content), Kind(Other.Kind), Ty(Other.Ty) {} - Access &operator=(const Access &Other) { - LocalI = Other.LocalI; - RemoteI = Other.RemoteI; - Content = Other.Content; - Kind = Other.Kind; - Ty = Other.Ty; - return *this; - } + Access &operator=(const Access &Other) = default; bool operator==(const Access &R) const { return LocalI == R.LocalI && RemoteI == R.RemoteI && Content == R.Content && Kind == R.Kind; @@ -4741,6 +4800,15 @@ struct AAPointerInfo : public AbstractAttribute { virtual bool forallInterferingAccesses( StoreInst &SI, function_ref<bool(const Access &, bool)> CB) const = 0; + /// Call \p CB on all write accesses that might interfere with \p LI and + /// return true if all such accesses were known and the callback returned true + /// for all of them, false otherwise. In contrast to forallInterferingAccesses + /// this function will perform reasoning to exclude write accesses that cannot + /// affect the load even if they on the surface look as if they would. + virtual bool forallInterferingWrites( + Attributor &A, const AbstractAttribute &QueryingAA, LoadInst &LI, + function_ref<bool(const Access &, bool)> CB) const = 0; + /// This function should return true if the type of the \p AA is AAPointerInfo static bool classof(const AbstractAttribute *AA) { return (AA->getIdAddr() == &ID); diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h index fd99843d0449..a2b93f8aa30d 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h @@ -14,6 +14,7 @@ #define LLVM_TRANSFORMS_IPO_FORCEFUNCTIONATTRS_H #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/IROutliner.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/IROutliner.h index ed74c8ed0e96..e4807a1c9c65 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/IROutliner.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/IROutliner.h @@ -337,11 +337,9 @@ private: /// be analyzed for similarity. This is needed as there may be instruction we /// can identify as having similarity, but are more complicated to outline. struct InstructionAllowed : public InstVisitor<InstructionAllowed, bool> { - InstructionAllowed() {} + InstructionAllowed() = default; - bool visitBranchInst(BranchInst &BI) { - return EnableBranches; - } + bool visitBranchInst(BranchInst &BI) { return EnableBranches; } bool visitPHINode(PHINode &PN) { return EnableBranches; } // TODO: Handle allocas. bool visitAllocaInst(AllocaInst &AI) { return false; } @@ -359,7 +357,7 @@ private: bool visitDbgInfoIntrinsic(DbgInfoIntrinsic &DII) { return true; } // TODO: Handle specific intrinsics individually from those that can be // handled. - bool IntrinsicInst(IntrinsicInst &II) { return false; } + bool IntrinsicInst(IntrinsicInst &II) { return EnableIntrinsics; } // We only handle CallInsts that are not indirect, since we cannot guarantee // that they have a name in these cases. bool visitCallInst(CallInst &CI) { @@ -395,6 +393,10 @@ private: // The flag variable that marks whether we should allow indirect calls // to be outlined. bool EnableIndirectCalls = true; + + // The flag variable that marks whether we should allow intrinsics + // instructions to be outlined. + bool EnableIntrinsics = false; }; /// A InstVisitor used to exclude certain instructions from being outlined. diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h index bb7907fb8ac8..302695d96355 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h @@ -17,6 +17,7 @@ #include "llvm/IR/Module.h" #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/SampleProfile.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/SampleProfile.h index 2b05aaf320cf..704b793ab3ea 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/SampleProfile.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/SampleProfile.h @@ -15,6 +15,7 @@ #define LLVM_TRANSFORMS_IPO_SAMPLEPROFILE_H #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" #include <string> namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h index 43f4bc78140f..e73c36043cb2 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h @@ -154,7 +154,7 @@ class PseudoProbeUpdatePass : public PassInfoMixin<PseudoProbeUpdatePass> { void runOnFunction(Function &F, FunctionAnalysisManager &FAM); public: - PseudoProbeUpdatePass() {} + PseudoProbeUpdatePass() = default; PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); }; diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h b/contrib/llvm-project/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h index f8cb6dc73a6f..ae19fbfb49a7 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h @@ -93,7 +93,7 @@ public: MinimizeSize(MinimizeSize), AA(AA), AC(AC), TLI(TLI), DT(DT), DL(DL), SQ(DL, &TLI, &DT, &AC), ORE(ORE), BFI(BFI), PSI(PSI), LI(LI) {} - virtual ~InstCombiner() {} + virtual ~InstCombiner() = default; /// Return the source operand of a potentially bitcasted value while /// optionally checking if it has one use. If there is no bitcast or the one diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h index 6002f0270083..a0d8118c23f7 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h @@ -16,6 +16,7 @@ #include "llvm/IR/Function.h" #include "llvm/IR/Module.h" #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" #include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h index 5a0fb835606a..0a5456c5956f 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h @@ -66,7 +66,7 @@ bool forAllReachableExits(const DominatorTree &DT, const PostDominatorTree &PDT, } SmallVector<Instruction *, 8> ReachableRetVec; unsigned NumCoveredExits = 0; - for (auto &RI : RetVec) { + for (auto *RI : RetVec) { if (!isPotentiallyReachable(Start, RI, nullptr, &DT)) continue; ReachableRetVec.push_back(RI); @@ -83,7 +83,7 @@ bool forAllReachableExits(const DominatorTree &DT, const PostDominatorTree &PDT, for (auto *End : Ends) Callback(End); } else { - for (auto &RI : ReachableRetVec) + for (auto *RI : ReachableRetVec) Callback(RI); // We may have inserted untag outside of the lifetime interval. // Signal the caller to remove the lifetime end call for this alloca. diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h index 8d70f1429b99..76d586252743 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h @@ -10,6 +10,7 @@ #define LLVM_TRANSFORMS_INSTRUMENTATION_BOUNDSCHECKING_H #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h index 3118a3762935..70949026a892 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h @@ -15,6 +15,7 @@ #include "llvm/IR/Function.h" #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h index 64523d7d073c..5873db22a5d1 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h @@ -87,21 +87,32 @@ private: /// Count the number of instrumented value sites for the function. void computeNumValueSiteCounts(InstrProfValueProfileInst *Ins); - /// Replace instrprof_value_profile with a call to runtime library. + /// Replace instrprof.value.profile with a call to runtime library. void lowerValueProfileInst(InstrProfValueProfileInst *Ins); - /// Replace instrprof_increment with an increment of the appropriate value. + /// Replace instrprof.cover with a store instruction to the coverage byte. + void lowerCover(InstrProfCoverInst *Inc); + + /// Replace instrprof.increment with an increment of the appropriate value. void lowerIncrement(InstrProfIncrementInst *Inc); /// Force emitting of name vars for unused functions. void lowerCoverageData(GlobalVariable *CoverageNamesVar); + /// Compute the address of the counter value that this profiling instruction + /// acts on. + Value *getCounterAddress(InstrProfInstBase *I); + /// Get the region counters for an increment, creating them if necessary. /// /// If the counter array doesn't yet exist, the profile data variables /// referring to them will also be created. GlobalVariable *getOrCreateRegionCounters(InstrProfInstBase *Inc); + /// Create the region counters. + GlobalVariable *createRegionCounters(InstrProfInstBase *Inc, StringRef Name, + GlobalValue::LinkageTypes Linkage); + /// Emit the section with compressed function names. void emitNameData(); diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h index f4d1b1d90e6f..b9ad56ba7509 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h @@ -15,6 +15,7 @@ #include "llvm/IR/Function.h" #include "llvm/IR/Module.h" #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h index 7ba9d65cae55..e83cc2b9bef0 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h @@ -73,7 +73,7 @@ class PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &, PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &, LPMUpdater &>> { public: - explicit PassManager() {} + explicit PassManager() = default; // FIXME: These are equivalent to the default move constructor/move // assignment. However, using = default triggers linker errors due to the diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/LowerConstantIntrinsics.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/LowerConstantIntrinsics.h index a5ad4a2192a0..61c7bf0454e1 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/LowerConstantIntrinsics.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/LowerConstantIntrinsics.h @@ -23,7 +23,7 @@ namespace llvm { struct LowerConstantIntrinsicsPass : PassInfoMixin<LowerConstantIntrinsicsPass> { public: - explicit LowerConstantIntrinsicsPass() {} + explicit LowerConstantIntrinsicsPass() = default; /// Run the pass over the function. /// diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/Scalarizer.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/Scalarizer.h index 81363130e2e3..f4472e699295 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/Scalarizer.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/Scalarizer.h @@ -18,6 +18,7 @@ #define LLVM_TRANSFORMS_SCALAR_SCALARIZER_H #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h index 04a5f7e6ff38..64691d68b1c4 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h @@ -14,6 +14,7 @@ #define LLVM_TRANSFORMS_SCALAR_WARNMISSEDTRANSFORMS_H #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { class Function; @@ -22,7 +23,7 @@ class Function; class WarnMissedTransformationsPass : public PassInfoMixin<WarnMissedTransformationsPass> { public: - explicit WarnMissedTransformationsPass() {} + explicit WarnMissedTransformationsPass() = default; PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); }; diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h index a497722eece6..d679bca69510 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h @@ -20,6 +20,7 @@ #include "llvm/IR/Attributes.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { class AssumptionCache; diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h index 8970afb3aeaa..d99b2a56559d 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h @@ -46,9 +46,9 @@ class Value; /// instruction. If \p Updates is specified, collect all necessary DT updates /// into this vector. If \p KeepOneInputPHIs is true, one-input Phis in /// successors of blocks being deleted will be preserved. -void DetatchDeadBlocks(ArrayRef <BasicBlock *> BBs, - SmallVectorImpl<DominatorTree::UpdateType> *Updates, - bool KeepOneInputPHIs = false); +void detachDeadBlocks(ArrayRef <BasicBlock *> BBs, + SmallVectorImpl<DominatorTree::UpdateType> *Updates, + bool KeepOneInputPHIs = false); /// Delete the specified block, which must have no predecessors. void DeleteDeadBlock(BasicBlock *BB, DomTreeUpdater *DTU = nullptr, diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h index f8211d60938e..e12d7e09aad6 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h @@ -53,7 +53,7 @@ class CallGraphUpdater { ///} public: - CallGraphUpdater() {} + CallGraphUpdater() = default; ~CallGraphUpdater() { finalize(); } /// Initializers for usage outside of a CGSCC pass, inside a CGSCC pass in diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/Debugify.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/Debugify.h index 0f1c7ec724df..892e354cd9ed 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/Debugify.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/Debugify.h @@ -21,6 +21,7 @@ #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/PassManager.h" #include "llvm/IR/ValueHandle.h" +#include "llvm/Pass.h" using DebugFnMap = llvm::MapVector<llvm::StringRef, const llvm::DISubprogram *>; using DebugInstMap = llvm::MapVector<const llvm::Instruction *, bool>; diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h index 84e4fee51c26..af9cdb9fd619 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h @@ -15,6 +15,7 @@ #include "llvm/IR/PassManager.h" #include "llvm/InitializePasses.h" +#include "llvm/Pass.h" namespace llvm { class InjectTLIMappings : public PassInfoMixin<InjectTLIMappings> { diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/LoopPeel.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/LoopPeel.h index 7b6595c192de..07dabaeaa907 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/LoopPeel.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/LoopPeel.h @@ -21,7 +21,7 @@ namespace llvm { bool canPeel(Loop *L); bool peelLoop(Loop *L, unsigned PeelCount, LoopInfo *LI, ScalarEvolution *SE, - DominatorTree *DT, AssumptionCache *AC, bool PreserveLCSSA); + DominatorTree &DT, AssumptionCache *AC, bool PreserveLCSSA); TargetTransformInfo::PeelingPreferences gatherPeelingPreferences(Loop *L, ScalarEvolution &SE, diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/ModuleUtils.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/ModuleUtils.h index 9bbe8ea7e1e8..8d459972336b 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/ModuleUtils.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/ModuleUtils.h @@ -15,6 +15,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/MemoryBuffer.h" #include <utility> // for std::pair namespace llvm { @@ -106,6 +107,10 @@ void filterDeadComdatFunctions( /// unique identifier for this module, so we return the empty string. std::string getUniqueModuleId(Module *M); +/// Embed the memory buffer \p Buf into the module \p M as a global using the +/// specified section name. +void embedBufferInModule(Module &M, MemoryBufferRef Buf, StringRef SectionName); + class CallInst; namespace VFABI { /// Overwrite the Vector Function ABI variants attribute with the names provide diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h index 5de575aed059..ad24cb454d5e 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h @@ -42,7 +42,7 @@ class SSAUpdaterBulk { SmallVector<Use *, 4> Uses; StringRef Name; Type *Ty; - RewriteInfo(){}; + RewriteInfo() = default; RewriteInfo(StringRef &N, Type *T) : Name(N), Ty(T){}; }; SmallVector<RewriteInfo, 4> Rewrites; @@ -52,10 +52,10 @@ class SSAUpdaterBulk { Value *computeValueAt(BasicBlock *BB, RewriteInfo &R, DominatorTree *DT); public: - explicit SSAUpdaterBulk(){}; + explicit SSAUpdaterBulk() = default; SSAUpdaterBulk(const SSAUpdaterBulk &) = delete; SSAUpdaterBulk &operator=(const SSAUpdaterBulk &) = delete; - ~SSAUpdaterBulk(){}; + ~SSAUpdaterBulk() = default; /// Add a new variable to the SSA rewriter. This needs to be called before /// AddAvailableValue or AddUse calls. The return value is the variable ID, diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h index f72c76c6f0f2..3636285e38f5 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h @@ -10,6 +10,7 @@ #define LLVM_TRANSFORMS_VECTORIZE_LOADSTOREVECTORIZER_H #include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/module.modulemap b/contrib/llvm-project/llvm/include/llvm/module.modulemap index 25c7aeee148e..d0693ccfd8f6 100644 --- a/contrib/llvm-project/llvm/include/llvm/module.modulemap +++ b/contrib/llvm-project/llvm/include/llvm/module.modulemap @@ -60,6 +60,7 @@ module LLVM_BinaryFormat { textual header "BinaryFormat/DynamicTags.def" textual header "BinaryFormat/MachO.def" textual header "BinaryFormat/MinidumpConstants.def" + textual header "BinaryFormat/Swift.def" textual header "BinaryFormat/ELFRelocs/AArch64.def" textual header "BinaryFormat/ELFRelocs/AMDGPU.def" textual header "BinaryFormat/ELFRelocs/ARM.def" |