Skip to content

Commit d141de6

Browse files
committed
Merge commit '73ac3b137101594663aad9901598dfa1aced9c78' into feature/merge-upstream-20220203
2 parents efe779a + 73ac3b1 commit d141de6

File tree

1,058 files changed

+23952
-10075
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,058 files changed

+23952
-10075
lines changed

bolt/lib/Target/X86/X86MCPlusBuilder.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,13 +1873,9 @@ class X86MCPlusBuilder : public MCPlusBuilder {
18731873
NewOpcode = Check.second;
18741874
if (Check.first == NOCHECK)
18751875
break;
1876-
if (Check.first == CHECK8 &&
1877-
ImmVal >= std::numeric_limits<int8_t>::min() &&
1878-
ImmVal <= std::numeric_limits<int8_t>::max())
1876+
if (Check.first == CHECK8 && isInt<8>(ImmVal))
18791877
break;
1880-
if (Check.first == CHECK32 &&
1881-
ImmVal >= std::numeric_limits<int32_t>::min() &&
1882-
ImmVal <= std::numeric_limits<int32_t>::max())
1878+
if (Check.first == CHECK32 && isInt<32>(ImmVal))
18831879
break;
18841880
}
18851881
if (NewOpcode == Inst.getOpcode())
@@ -3012,12 +3008,9 @@ class X86MCPlusBuilder : public MCPlusBuilder {
30123008
NewOpcode = Check.second;
30133009
if (Check.first == NOCHECK)
30143010
break;
3015-
if (Check.first == CHECK8 && Imm >= std::numeric_limits<int8_t>::min() &&
3016-
Imm <= std::numeric_limits<int8_t>::max())
3011+
if (Check.first == CHECK8 && isInt<8>(Imm))
30173012
break;
3018-
if (Check.first == CHECK32 &&
3019-
Imm >= std::numeric_limits<int32_t>::min() &&
3020-
Imm <= std::numeric_limits<int32_t>::max())
3013+
if (Check.first == CHECK32 && isInt<32>(Imm))
30213014
break;
30223015
}
30233016
if (NewOpcode == Inst.getOpcode())

bolt/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ list(APPEND BOLT_TEST_DEPS
3838
llvm-config
3939
llvm-bolt
4040
llvm-boltdiff
41+
llvm-bolt-heatmap
4142
llvm-dwarfdump
4243
llvm-mc
4344
llvm-nm

bolt/test/heatmap.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Verifies basic functioning of heatmap mode
2+
3+
REQUIRES: system-linux
4+
XFAIL: *
5+
6+
RUN: llvm-bolt heatmap --help | FileCheck %s --check-prefix=CHECK-SUBCOMMAND
7+
CHECK-SUBCOMMAND: SUBCOMMAND 'heatmap': generate heatmap
8+
CHECK-SUBCOMMAND: USAGE: llvm-bolt heatmap [options] <executable>
9+
10+
RUN: llvm-bolt-heatmap --help | FileCheck %s --check-prefix=CHECK-STANDALONE
11+
CHECK-STANDALONE: SUBCOMMAND 'heatmap': generate heatmap
12+
CHECK-STANDALONE: USAGE: llvm-bolt-heatmap heatmap [options] <executable>

bolt/test/lit.cfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
ToolSubst('llvm-dwarfdump', unresolved='fatal'),
7474
ToolSubst('llvm-bolt', unresolved='fatal'),
7575
ToolSubst('llvm-boltdiff', unresolved='fatal'),
76+
ToolSubst('llvm-bolt-heatmap', unresolved='fatal'),
7677
ToolSubst('perf2bolt', unresolved='fatal'),
7778
ToolSubst('yaml2obj', unresolved='fatal'),
7879
ToolSubst('llvm-mc', unresolved='fatal'),

clang/docs/CommandGuide/clang.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,11 @@ number of cross compilers, or may only support a native target.
323323

324324
.. option:: -arch <architecture>
325325

326-
Specify the architecture to build for.
326+
Specify the architecture to build for (Mac OS X specific).
327+
328+
.. option:: -target <architecture>
329+
330+
Specify the architecture to build for (all platforms).
327331

328332
.. option:: -mmacosx-version-min=<version>
329333

clang/docs/LanguageExtensions.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,11 @@ The following type trait primitives are supported by Clang. Those traits marked
14301430
* ``__is_trivially_constructible`` (C++, GNU, Microsoft)
14311431
* ``__is_trivially_copyable`` (C++, GNU, Microsoft)
14321432
* ``__is_trivially_destructible`` (C++, MSVC 2013)
1433+
* ``__is_trivially_relocatable`` (Clang): Returns true if moving an object
1434+
of the given type, and then destroying the source object, is known to be
1435+
functionally equivalent to copying the underlying bytes and then dropping the
1436+
source object on the floor. This is true of trivial types and types which
1437+
were made trivially relocatable via the ``clang::trivial_abi`` attribute.
14331438
* ``__is_union`` (C++, GNU, Microsoft, Embarcadero)
14341439
* ``__is_unsigned`` (C++, Embarcadero):
14351440
Returns false for enumeration types. Note, before Clang 13, returned true for

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ Modified Compiler Flags
6767
Removed Compiler Flags
6868
-------------------------
6969

70+
- -Wweak-template-vtables, which was deprecated in the previous release and no
71+
longer had any effect, has been removed.
72+
7073
New Pragmas in Clang
7174
--------------------
7275

clang/include/clang/AST/Type.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,8 @@ class QualType {
829829
/// Return true if this is a trivially copyable type (C++0x [basic.types]p9)
830830
bool isTriviallyCopyableType(const ASTContext &Context) const;
831831

832+
/// Return true if this is a trivially relocatable type.
833+
bool isTriviallyRelocatableType(const ASTContext &Context) const;
832834

833835
/// Returns true if it is a class and it might be dynamic.
834836
bool mayBeDynamicClass() const;

clang/include/clang/ASTMatchers/ASTMatchersInternal.h

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -600,17 +600,15 @@ class Matcher {
600600
/// Convert \c this into a \c Matcher<T> by applying dyn_cast<> to the
601601
/// argument.
602602
/// \c To must be a base class of \c T.
603-
template <typename To> Matcher<To> dynCastTo() const LLVM_LVALUE_FUNCTION {
603+
template <typename To> Matcher<To> dynCastTo() const & {
604604
static_assert(std::is_base_of<To, T>::value, "Invalid dynCast call.");
605605
return Matcher<To>(Implementation);
606606
}
607607

608-
#if LLVM_HAS_RVALUE_REFERENCE_THIS
609608
template <typename To> Matcher<To> dynCastTo() && {
610609
static_assert(std::is_base_of<To, T>::value, "Invalid dynCast call.");
611610
return Matcher<To>(std::move(Implementation));
612611
}
613-
#endif
614612

615613
/// Forwards the call to the underlying MatcherInterface<T> pointer.
616614
bool matches(const T &Node,
@@ -628,13 +626,9 @@ class Matcher {
628626
///
629627
/// The returned matcher keeps the same restrictions as \c this and remembers
630628
/// that it is meant to support nodes of type \c T.
631-
operator DynTypedMatcher() const LLVM_LVALUE_FUNCTION {
632-
return Implementation;
633-
}
629+
operator DynTypedMatcher() const & { return Implementation; }
634630

635-
#if LLVM_HAS_RVALUE_REFERENCE_THIS
636631
operator DynTypedMatcher() && { return std::move(Implementation); }
637-
#endif
638632

639633
/// Allows the conversion of a \c Matcher<Type> to a \c
640634
/// Matcher<QualType>.
@@ -1361,35 +1355,31 @@ template <typename... Ps> class VariadicOperatorMatcher {
13611355
VariadicOperatorMatcher(DynTypedMatcher::VariadicOperator Op, Ps &&... Params)
13621356
: Op(Op), Params(std::forward<Ps>(Params)...) {}
13631357

1364-
template <typename T> operator Matcher<T>() const LLVM_LVALUE_FUNCTION {
1358+
template <typename T> operator Matcher<T>() const & {
13651359
return DynTypedMatcher::constructVariadic(
13661360
Op, ASTNodeKind::getFromNodeKind<T>(),
13671361
getMatchers<T>(std::index_sequence_for<Ps...>()))
13681362
.template unconditionalConvertTo<T>();
13691363
}
13701364

1371-
#if LLVM_HAS_RVALUE_REFERENCE_THIS
13721365
template <typename T> operator Matcher<T>() && {
13731366
return DynTypedMatcher::constructVariadic(
13741367
Op, ASTNodeKind::getFromNodeKind<T>(),
13751368
getMatchers<T>(std::index_sequence_for<Ps...>()))
13761369
.template unconditionalConvertTo<T>();
13771370
}
1378-
#endif
1371+
13791372
private:
13801373
// Helper method to unpack the tuple into a vector.
13811374
template <typename T, std::size_t... Is>
1382-
std::vector<DynTypedMatcher>
1383-
getMatchers(std::index_sequence<Is...>) const LLVM_LVALUE_FUNCTION {
1375+
std::vector<DynTypedMatcher> getMatchers(std::index_sequence<Is...>) const & {
13841376
return {Matcher<T>(std::get<Is>(Params))...};
13851377
}
13861378

1387-
#if LLVM_HAS_RVALUE_REFERENCE_THIS
13881379
template <typename T, std::size_t... Is>
13891380
std::vector<DynTypedMatcher> getMatchers(std::index_sequence<Is...>) && {
13901381
return {Matcher<T>(std::get<Is>(std::move(Params)))...};
13911382
}
1392-
#endif
13931383

13941384
const DynTypedMatcher::VariadicOperator Op;
13951385
std::tuple<Ps...> Params;
@@ -1479,15 +1469,13 @@ class ArgumentAdaptingMatcherFuncAdaptor {
14791469

14801470
using ReturnTypes = ToTypes;
14811471

1482-
template <typename To> operator Matcher<To>() const LLVM_LVALUE_FUNCTION {
1472+
template <typename To> operator Matcher<To>() const & {
14831473
return Matcher<To>(new ArgumentAdapterT<To, T>(InnerMatcher));
14841474
}
14851475

1486-
#if LLVM_HAS_RVALUE_REFERENCE_THIS
14871476
template <typename To> operator Matcher<To>() && {
14881477
return Matcher<To>(new ArgumentAdapterT<To, T>(std::move(InnerMatcher)));
14891478
}
1490-
#endif
14911479

14921480
private:
14931481
Matcher<T> InnerMatcher;
@@ -1558,21 +1546,19 @@ template <typename MatcherType> class TraversalWrapper {
15581546
TraversalWrapper(TraversalKind TK, const MatcherType &InnerMatcher)
15591547
: TK(TK), InnerMatcher(InnerMatcher) {}
15601548

1561-
template <typename T> operator Matcher<T>() const LLVM_LVALUE_FUNCTION {
1549+
template <typename T> operator Matcher<T>() const & {
15621550
return internal::DynTypedMatcher::constructRestrictedWrapper(
15631551
new internal::TraversalMatcher<T>(TK, InnerMatcher),
15641552
ASTNodeKind::getFromNodeKind<T>())
15651553
.template unconditionalConvertTo<T>();
15661554
}
15671555

1568-
#if LLVM_HAS_RVALUE_REFERENCE_THIS
15691556
template <typename T> operator Matcher<T>() && {
15701557
return internal::DynTypedMatcher::constructRestrictedWrapper(
15711558
new internal::TraversalMatcher<T>(TK, std::move(InnerMatcher)),
15721559
ASTNodeKind::getFromNodeKind<T>())
15731560
.template unconditionalConvertTo<T>();
15741561
}
1575-
#endif
15761562

15771563
private:
15781564
TraversalKind TK;
@@ -1599,20 +1585,18 @@ class PolymorphicMatcher {
15991585

16001586
using ReturnTypes = typename ExtractFunctionArgMeta<ReturnTypesF>::type;
16011587

1602-
template <typename T> operator Matcher<T>() const LLVM_LVALUE_FUNCTION {
1588+
template <typename T> operator Matcher<T>() const & {
16031589
static_assert(TypeListContainsSuperOf<ReturnTypes, T>::value,
16041590
"right polymorphic conversion");
16051591
return Matcher<T>(new_from_tuple<MatcherT<T, ParamTypes...>>(Params));
16061592
}
16071593

1608-
#if LLVM_HAS_RVALUE_REFERENCE_THIS
16091594
template <typename T> operator Matcher<T>() && {
16101595
static_assert(TypeListContainsSuperOf<ReturnTypes, T>::value,
16111596
"right polymorphic conversion");
16121597
return Matcher<T>(
16131598
new_from_tuple<MatcherT<T, ParamTypes...>>(std::move(Params)));
16141599
}
1615-
#endif
16161600

16171601
private:
16181602
std::tuple<ParamTypes...> Params;

clang/include/clang/Basic/AttrDocs.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3295,6 +3295,9 @@ If a type is trivial for the purposes of calls, has a non-trivial destructor,
32953295
and is passed as an argument by value, the convention is that the callee will
32963296
destroy the object before returning.
32973297

3298+
If a type is trivial for the purpose of calls, it is assumed to be trivially
3299+
relocatable for the purpose of ``__is_trivially_relocatable``.
3300+
32983301
Attribute ``trivial_abi`` has no effect in the following cases:
32993302

33003303
- The class directly declares a virtual base or virtual methods.

0 commit comments

Comments
 (0)