Skip to content

Commit 69e5e4c

Browse files
authored
Merge branch 'main' into hugo.DropUnitDimFromBroadcastOp
2 parents 6df6377 + 3e15c97 commit 69e5e4c

File tree

830 files changed

+27317
-26055
lines changed

Some content is hidden

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

830 files changed

+27317
-26055
lines changed

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ ErrorOr<Location> DataAggregator::parseLocationOrOffset() {
12271227
if (Sep == StringRef::npos)
12281228
return parseOffset();
12291229
StringRef LookAhead = ParsingBuf.substr(0, Sep);
1230-
if (LookAhead.find_first_of(":") == StringRef::npos)
1230+
if (!LookAhead.contains(':'))
12311231
return parseOffset();
12321232

12331233
ErrorOr<StringRef> BuildID = parseString(':');

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4808,6 +4808,40 @@ void RewriteInstance::updateELFSymbolTable(
48084808
// Create a new symbol based on the existing symbol.
48094809
ELFSymTy NewSymbol = Symbol;
48104810

4811+
// Handle special symbols based on their name.
4812+
Expected<StringRef> SymbolName = Symbol.getName(StringSection);
4813+
assert(SymbolName && "cannot get symbol name");
4814+
4815+
auto updateSymbolValue = [&](const StringRef Name,
4816+
std::optional<uint64_t> Value = std::nullopt) {
4817+
NewSymbol.st_value = Value ? *Value : getNewValueForSymbol(Name);
4818+
NewSymbol.st_shndx = ELF::SHN_ABS;
4819+
BC->outs() << "BOLT-INFO: setting " << Name << " to 0x"
4820+
<< Twine::utohexstr(NewSymbol.st_value) << '\n';
4821+
};
4822+
4823+
if (*SymbolName == "__hot_start" || *SymbolName == "__hot_end") {
4824+
if (opts::HotText) {
4825+
updateSymbolValue(*SymbolName);
4826+
++NumHotTextSymsUpdated;
4827+
}
4828+
goto registerSymbol;
4829+
}
4830+
4831+
if (*SymbolName == "__hot_data_start" || *SymbolName == "__hot_data_end") {
4832+
if (opts::HotData) {
4833+
updateSymbolValue(*SymbolName);
4834+
++NumHotDataSymsUpdated;
4835+
}
4836+
goto registerSymbol;
4837+
}
4838+
4839+
if (*SymbolName == "_end") {
4840+
if (NextAvailableAddress > Symbol.st_value)
4841+
updateSymbolValue(*SymbolName, NextAvailableAddress);
4842+
goto registerSymbol;
4843+
}
4844+
48114845
if (Function) {
48124846
// If the symbol matched a function that was not emitted, update the
48134847
// corresponding section index but otherwise leave it unchanged.
@@ -4904,33 +4938,7 @@ void RewriteInstance::updateELFSymbolTable(
49044938
}
49054939
}
49064940

4907-
// Handle special symbols based on their name.
4908-
Expected<StringRef> SymbolName = Symbol.getName(StringSection);
4909-
assert(SymbolName && "cannot get symbol name");
4910-
4911-
auto updateSymbolValue = [&](const StringRef Name,
4912-
std::optional<uint64_t> Value = std::nullopt) {
4913-
NewSymbol.st_value = Value ? *Value : getNewValueForSymbol(Name);
4914-
NewSymbol.st_shndx = ELF::SHN_ABS;
4915-
BC->outs() << "BOLT-INFO: setting " << Name << " to 0x"
4916-
<< Twine::utohexstr(NewSymbol.st_value) << '\n';
4917-
};
4918-
4919-
if (opts::HotText &&
4920-
(*SymbolName == "__hot_start" || *SymbolName == "__hot_end")) {
4921-
updateSymbolValue(*SymbolName);
4922-
++NumHotTextSymsUpdated;
4923-
}
4924-
4925-
if (opts::HotData && (*SymbolName == "__hot_data_start" ||
4926-
*SymbolName == "__hot_data_end")) {
4927-
updateSymbolValue(*SymbolName);
4928-
++NumHotDataSymsUpdated;
4929-
}
4930-
4931-
if (*SymbolName == "_end" && NextAvailableAddress > Symbol.st_value)
4932-
updateSymbolValue(*SymbolName, NextAvailableAddress);
4933-
4941+
registerSymbol:
49344942
if (IsDynSym)
49354943
Write((&Symbol - cantFail(Obj.symbols(&SymTabSection)).begin()) *
49364944
sizeof(ELFSymTy),

bolt/test/runtime/X86/hot-end-symbol.s

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
1313

1414
# RUN: llvm-bolt %t.exe --relocs=1 --hot-text --reorder-functions=hfsort \
15+
# RUN: --split-functions --split-strategy=all \
1516
# RUN: --data %t.fdata -o %t.out | FileCheck %s
1617

1718
# RUN: %t.out 1
@@ -30,12 +31,12 @@
3031
# CHECK-OUTPUT: __hot_start
3132
# CHECK-OUTPUT-NEXT: main
3233
# CHECK-OUTPUT-NEXT: __hot_end
34+
# CHECK-OUTPUT-NOT: __hot_start.cold
3335

3436
.text
3537
.globl main
3638
.type main, %function
3739
.globl __hot_start
38-
.type __hot_start, %object
3940
.p2align 4
4041
main:
4142
__hot_start:

clang-tools-extra/clangd/test/infinite-instantiation.test

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// RUN: cp %s %t.cpp
2-
// RUN: not clangd -check=%t.cpp 2>&1 | FileCheck -strict-whitespace %s
1+
// RUN: rm -rf %t.dir && mkdir -p %t.dir
2+
// RUN: echo '[{"directory": "%/t.dir", "command": "clang -ftemplate-depth=100 -x c++ %s", "file": "%/s"}]' > %t.dir/compile_commands.json
3+
// RUN: not clangd --compile-commands-dir=%t.dir -check=%s 2>&1 | FileCheck -strict-whitespace %s
34

45
// CHECK: [template_recursion_depth_exceeded]
56

clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ struct X {
55
// CHECK-MESSAGES: :[[@LINE-1]]:5: error: field has incomplete type 'X' [clang-diagnostic-error]
66
int a = 10;
77
};
8+
9+
template <typename T> class NoCrash {
10+
// CHECK-MESSAGES: :[[@LINE+2]]:20: error: base class has incomplete type
11+
// CHECK-MESSAGES: :[[@LINE-2]]:29: note: definition of 'NoCrash<T>' is not complete until the closing '}'
12+
class B : public NoCrash {
13+
template <typename U> B(U u) {}
14+
};
15+
};

clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,6 @@ struct NegativeIncompleteArrayMember {
463463
char e[];
464464
};
465465

466-
template <typename T> class NoCrash {
467-
class B : public NoCrash {
468-
template <typename U> B(U u) {}
469-
};
470-
};
471-
472466
struct PositiveBitfieldMember {
473467
PositiveBitfieldMember() {}
474468
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor does not initialize these fields: F

clang/cmake/caches/HLSL.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra" CACHE STRING "")
1212

1313
set(CLANG_ENABLE_HLSL On CACHE BOOL "")
1414

15-
if (NOT CMAKE_CONFIGURATION_TYPES)
15+
if (HLSL_ENABLE_DISTRIBUTION)
1616
set(LLVM_DISTRIBUTION_COMPONENTS
1717
"clang;hlsl-resource-headers;clangd"
1818
CACHE STRING "")

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,13 @@ Bug Fixes to C++ Support
742742
- Fix a bug with checking constrained non-type template parameters for equivalence. Fixes (#GH77377).
743743
- Fix a bug where the last argument was not considered when considering the most viable function for
744744
explicit object argument member functions. Fixes (#GH92188).
745+
- Fix a C++11 crash when a non-const non-static member function is defined out-of-line with
746+
the ``constexpr`` specifier. Fixes (#GH61004).
747+
- Clang no longer transforms dependent qualified names into implicit class member access expressions
748+
until it can be determined whether the name is that of a non-static member.
749+
- Clang now correctly diagnoses when the current instantiation is used as an incomplete base class.
750+
- Clang no longer treats ``constexpr`` class scope function template specializations of non-static members
751+
as implicitly ``const`` in language modes after C++11.
745752

746753
Bug Fixes to AST Handling
747754
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/docs/tools/clang-formatted-files.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ clang/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
124124
clang/include/clang/Analysis/Analyses/ExprMutationAnalyzer.h
125125
clang/include/clang/Analysis/FlowSensitive/AdornedCFG.h
126126
clang/include/clang/Analysis/FlowSensitive/ASTOps.h
127+
clang/include/clang/Analysis/FlowSensitive/CNFFormula.h
127128
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
128129
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h
129130
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
@@ -621,6 +622,7 @@ clang/tools/libclang/CXCursor.h
621622
clang/tools/scan-build-py/tests/functional/src/include/clean-one.h
622623
clang/unittests/Analysis/CFGBuildResult.h
623624
clang/unittests/Analysis/MacroExpansionContextTest.cpp
625+
clang/unittests/Analysis/FlowSensitive/CNFFormula.cpp
624626
clang/unittests/Analysis/FlowSensitive/DataflowAnalysisContextTest.cpp
625627
clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp
626628
clang/unittests/Analysis/FlowSensitive/MapLatticeTest.cpp
@@ -632,6 +634,7 @@ clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp
632634
clang/unittests/Analysis/FlowSensitive/TestingSupport.h
633635
clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp
634636
clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
637+
clang/unittests/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp
635638
clang/unittests/Analysis/FlowSensitive/WatchedLiteralsSolverTest.cpp
636639
clang/unittests/AST/ASTImporterFixtures.cpp
637640
clang/unittests/AST/ASTImporterFixtures.h

clang/include/clang/AST/ASTContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2611,7 +2611,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
26112611
///
26122612
/// \returns if this is an array type, the completely unqualified array type
26132613
/// that corresponds to it. Otherwise, returns T.getUnqualifiedType().
2614-
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals);
2614+
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals) const;
26152615

26162616
/// Determine whether the given types are equivalent after
26172617
/// cvr-qualifiers have been removed.

clang/include/clang/AST/ExprCXX.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4377,15 +4377,21 @@ class PackIndexingExpr final
43774377
// The pack being indexed, followed by the index
43784378
Stmt *SubExprs[2];
43794379

4380-
size_t TransformedExpressions;
4380+
// The size of the trailing expressions.
4381+
unsigned TransformedExpressions : 31;
4382+
4383+
LLVM_PREFERRED_TYPE(bool)
4384+
unsigned ExpandedToEmptyPack : 1;
43814385

43824386
PackIndexingExpr(QualType Type, SourceLocation EllipsisLoc,
43834387
SourceLocation RSquareLoc, Expr *PackIdExpr, Expr *IndexExpr,
4384-
ArrayRef<Expr *> SubstitutedExprs = {})
4388+
ArrayRef<Expr *> SubstitutedExprs = {},
4389+
bool ExpandedToEmptyPack = false)
43854390
: Expr(PackIndexingExprClass, Type, VK_LValue, OK_Ordinary),
43864391
EllipsisLoc(EllipsisLoc), RSquareLoc(RSquareLoc),
43874392
SubExprs{PackIdExpr, IndexExpr},
4388-
TransformedExpressions(SubstitutedExprs.size()) {
4393+
TransformedExpressions(SubstitutedExprs.size()),
4394+
ExpandedToEmptyPack(ExpandedToEmptyPack) {
43894395

43904396
auto *Exprs = getTrailingObjects<Expr *>();
43914397
std::uninitialized_copy(SubstitutedExprs.begin(), SubstitutedExprs.end(),
@@ -4408,10 +4414,14 @@ class PackIndexingExpr final
44084414
SourceLocation EllipsisLoc,
44094415
SourceLocation RSquareLoc, Expr *PackIdExpr,
44104416
Expr *IndexExpr, std::optional<int64_t> Index,
4411-
ArrayRef<Expr *> SubstitutedExprs = {});
4417+
ArrayRef<Expr *> SubstitutedExprs = {},
4418+
bool ExpandedToEmptyPack = false);
44124419
static PackIndexingExpr *CreateDeserialized(ASTContext &Context,
44134420
unsigned NumTransformedExprs);
44144421

4422+
/// Determine if the expression was expanded to empty.
4423+
bool expandsToEmptyPack() const { return ExpandedToEmptyPack; }
4424+
44154425
/// Determine the location of the 'sizeof' keyword.
44164426
SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
44174427

@@ -4445,6 +4455,7 @@ class PackIndexingExpr final
44454455
return getTrailingObjects<Expr *>()[*Index];
44464456
}
44474457

4458+
/// Return the trailing expressions, regardless of the expansion.
44484459
ArrayRef<Expr *> getExpressions() const {
44494460
return {getTrailingObjects<Expr *>(), TransformedExpressions};
44504461
}

clang/include/clang/AST/OpenACCClause.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,35 @@ class OpenACCCreateClause final
677677
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
678678
};
679679

680+
class OpenACCReductionClause final
681+
: public OpenACCClauseWithVarList,
682+
public llvm::TrailingObjects<OpenACCReductionClause, Expr *> {
683+
OpenACCReductionOperator Op;
684+
685+
OpenACCReductionClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
686+
OpenACCReductionOperator Operator,
687+
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
688+
: OpenACCClauseWithVarList(OpenACCClauseKind::Reduction, BeginLoc,
689+
LParenLoc, EndLoc),
690+
Op(Operator) {
691+
std::uninitialized_copy(VarList.begin(), VarList.end(),
692+
getTrailingObjects<Expr *>());
693+
setExprs(MutableArrayRef(getTrailingObjects<Expr *>(), VarList.size()));
694+
}
695+
696+
public:
697+
static bool classof(const OpenACCClause *C) {
698+
return C->getClauseKind() == OpenACCClauseKind::Reduction;
699+
}
700+
701+
static OpenACCReductionClause *
702+
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
703+
OpenACCReductionOperator Operator, ArrayRef<Expr *> VarList,
704+
SourceLocation EndLoc);
705+
706+
OpenACCReductionOperator getReductionOp() const { return Op; }
707+
};
708+
680709
template <class Impl> class OpenACCClauseVisitor {
681710
Impl &getDerived() { return static_cast<Impl &>(*this); }
682711

clang/include/clang/AST/Type.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,6 +2523,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
25232523
bool isVectorType() const; // GCC vector type.
25242524
bool isExtVectorType() const; // Extended vector type.
25252525
bool isExtVectorBoolType() const; // Extended vector type with bool element.
2526+
bool isSubscriptableVectorType() const;
25262527
bool isMatrixType() const; // Matrix type.
25272528
bool isConstantMatrixType() const; // Constant matrix type.
25282529
bool isDependentAddressSpaceType() const; // value-dependent address space qualifier
@@ -7729,6 +7730,10 @@ inline bool Type::isExtVectorBoolType() const {
77297730
return cast<ExtVectorType>(CanonicalType)->getElementType()->isBooleanType();
77307731
}
77317732

7733+
inline bool Type::isSubscriptableVectorType() const {
7734+
return isVectorType() || isSveVLSBuiltinType();
7735+
}
7736+
77327737
inline bool Type::isMatrixType() const {
77337738
return isa<MatrixType>(CanonicalType);
77347739
}

0 commit comments

Comments
 (0)