Skip to content

Commit 90d0837

Browse files
committed
merge main into amd-staging
2 parents 47cf464 + 6f1b5ed commit 90d0837

File tree

42 files changed

+1277
-503
lines changed

Some content is hidden

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

42 files changed

+1277
-503
lines changed

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ mergeInfos(std::vector<std::unique_ptr<Info>> &Values) {
147147
return llvm::createStringError(llvm::inconvertibleErrorCode(),
148148
"unexpected info type");
149149
}
150+
llvm_unreachable("unhandled enumerator");
150151
}
151152

152153
bool CommentInfo::operator==(const CommentInfo &Other) const {

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ std::string serialize(std::unique_ptr<Info> &I) {
392392
case InfoType::IT_default:
393393
return "";
394394
}
395+
llvm_unreachable("unhandled enumerator");
395396
}
396397

397398
static void parseFullComment(const FullComment *C, CommentInfo &CI) {

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ Bug Fixes in This Version
720720
- Fixed a bug with constexpr evaluation for structs containing unions in case of C++ modules. (#GH143168)
721721
- Fixed incorrect token location when emitting diagnostics for tokens expanded from macros. (#GH143216)
722722
- Fixed an infinite recursion when checking constexpr destructors. (#GH141789)
723+
- Fixed a crash when a malformed using declaration appears in a ``constexpr`` function. (#GH144264)
723724

724725
Bug Fixes to Compiler Builtins
725726
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -815,19 +815,22 @@ changes to one object won't affect the others, the object's initializer will run
815815
once per copy, etc.
816816

817817
Specifically, this warning fires when it detects an object which:
818-
1. Is defined as ``inline`` in a header file (so it might get compiled into multiple libaries), and
819-
2. Has external linkage (otherwise it's supposed to be duplicated), and
820-
3. Has hidden visibility (posix) or lacks a dllimport/dllexport attribute (windows).
818+
819+
#. Is defined as ``inline`` in a header file (so it might get compiled into multiple libaries), and
820+
#. Has external linkage (otherwise it's supposed to be duplicated), and
821+
#. Has hidden visibility (posix) or lacks a dllimport/dllexport attribute (windows).
821822

822823
As well as one of the following:
823-
1. The object is mutable, or
824-
2. The object's initializer definitely has side effects.
824+
825+
#. The object is mutable, or
826+
#. The object's initializer definitely has side effects.
825827

826828
The warning can be resolved by removing one of the conditions above. In rough
827829
order of preference, this may be done by:
828-
1. Marking the object ``const`` (if possible)
829-
2. Moving the object's definition to a source file
830-
3. Making the object visible using ``__attribute((visibility("default")))``,
830+
831+
#. Marking the object ``const`` (if possible)
832+
#. Moving the object's definition to a source file
833+
#. Making the object visible using ``__attribute((visibility("default")))``,
831834
``__declspec(dllimport)``, or ``__declspec(dllexport)``.
832835

833836
When annotating an object with ``__declspec(dllimport)`` or ``__declspec(dllexport)``,

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,10 @@ Parser::DeclGroupPtrTy Parser::ParseUsingDeclaration(
760760

761761
Decl *AD = ParseAliasDeclarationAfterDeclarator(
762762
TemplateInfo, UsingLoc, D, DeclEnd, AS, Attrs, &DeclFromDeclSpec);
763+
764+
if (!AD)
765+
return nullptr;
766+
763767
return Actions.ConvertDeclToDeclGroup(AD, DeclFromDeclSpec);
764768
}
765769

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %clang_cc1 -fsyntax-only -verify %s
2+
3+
// issue144264
4+
constexpr void test()
5+
{
6+
using TT = struct T[;
7+
// expected-error@-1 {{expected expression}}
8+
}

clang/utils/TableGen/ClangAttrEmitter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3739,7 +3739,8 @@ static void GenerateHasAttrSpellingStringSwitch(
37393739
: '(' + itostr(Version) + ')';
37403740

37413741
if (Scope.empty() || Scope == Spelling.nameSpace()) {
3742-
if (TestStringMap.contains(Spelling.name()))
3742+
if (TestStringMap.contains(Spelling.name()) &&
3743+
TestStringMap[Spelling.name()] != TestStr)
37433744
TestStringMap[Spelling.name()] += " || " + TestStr;
37443745
else
37453746
TestStringMap[Spelling.name()] = TestStr;

flang/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ if (NOT FLANG_STANDALONE_BUILD)
7373
not
7474
llvm-dis
7575
llvm-objdump
76+
llvm-profdata
7677
llvm-readobj
7778
split-file
7879
)

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,12 +478,12 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
478478
}
479479

480480
bool isIndexedLoadLegal(TTI::MemIndexedMode M, Type *Ty) const override {
481-
EVT VT = getTLI()->getValueType(DL, Ty);
481+
EVT VT = getTLI()->getValueType(DL, Ty, /*AllowUnknown=*/true);
482482
return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
483483
}
484484

485485
bool isIndexedStoreLegal(TTI::MemIndexedMode M, Type *Ty) const override {
486-
EVT VT = getTLI()->getValueType(DL, Ty);
486+
EVT VT = getTLI()->getValueType(DL, Ty, /*AllowUnknown=*/true);
487487
return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
488488
}
489489

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ namespace {
396396
bool PromoteLoad(SDValue Op);
397397

398398
SDValue foldShiftToAvg(SDNode *N);
399+
// Fold `a bitwiseop (~b +/- c)` -> `a bitwiseop ~(b -/+ c)`
400+
SDValue foldBitwiseOpWithNeg(SDNode *N, const SDLoc &DL, EVT VT);
399401

400402
SDValue combineMinNumMaxNum(const SDLoc &DL, EVT VT, SDValue LHS,
401403
SDValue RHS, SDValue True, SDValue False,
@@ -7541,6 +7543,12 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
75417543
return DAG.getNode(ISD::AND, DL, VT, X,
75427544
DAG.getNOT(DL, DAG.getNode(Opc, DL, VT, Y, Z), VT));
75437545

7546+
// Fold (and X, (add (not Y), Z)) -> (and X, (not (sub Y, Z)))
7547+
// Fold (and X, (sub (not Y), Z)) -> (and X, (not (add Y, Z)))
7548+
if (TLI.hasAndNot(SDValue(N, 0)))
7549+
if (SDValue Folded = foldBitwiseOpWithNeg(N, DL, VT))
7550+
return Folded;
7551+
75447552
// Fold (and (srl X, C), 1) -> (srl X, BW-1) for signbit extraction
75457553
// If we are shifting down an extended sign bit, see if we can simplify
75467554
// this to shifting the MSB directly to expose further simplifications.
@@ -11652,6 +11660,22 @@ SDValue DAGCombiner::foldShiftToAvg(SDNode *N) {
1165211660
return DAG.getNode(FloorISD, SDLoc(N), N->getValueType(0), {A, B});
1165311661
}
1165411662

11663+
SDValue DAGCombiner::foldBitwiseOpWithNeg(SDNode *N, const SDLoc &DL, EVT VT) {
11664+
unsigned Opc = N->getOpcode();
11665+
SDValue X, Y, Z;
11666+
if (sd_match(
11667+
N, m_BitwiseLogic(m_Value(X), m_Add(m_Not(m_Value(Y)), m_Value(Z)))))
11668+
return DAG.getNode(Opc, DL, VT, X,
11669+
DAG.getNOT(DL, DAG.getNode(ISD::SUB, DL, VT, Y, Z), VT));
11670+
11671+
if (sd_match(N, m_BitwiseLogic(m_Value(X), m_Sub(m_OneUse(m_Not(m_Value(Y))),
11672+
m_Value(Z)))))
11673+
return DAG.getNode(Opc, DL, VT, X,
11674+
DAG.getNOT(DL, DAG.getNode(ISD::ADD, DL, VT, Y, Z), VT));
11675+
11676+
return SDValue();
11677+
}
11678+
1165511679
/// Generate Min/Max node
1165611680
SDValue DAGCombiner::combineMinNumMaxNum(const SDLoc &DL, EVT VT, SDValue LHS,
1165711681
SDValue RHS, SDValue True,

0 commit comments

Comments
 (0)