Skip to content

Commit 2845237

Browse files
authored
Merge branch 'main' into unroll-scatter-ops
2 parents 02e6e67 + c7d8581 commit 2845237

File tree

21 files changed

+1042
-600
lines changed

21 files changed

+1042
-600
lines changed

clang/docs/ReleaseNotes.rst

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

708709
Bug Fixes to Compiler Builtins
709710
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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+
}

llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2507,7 +2507,7 @@ class OpenMPIRBuilder {
25072507
TargetTaskBodyCallbackTy TaskBodyCB, Value *DeviceID, Value *RTLoc,
25082508
OpenMPIRBuilder::InsertPointTy AllocaIP,
25092509
const SmallVector<llvm::OpenMPIRBuilder::DependData> &Dependencies,
2510-
bool HasNoWait);
2510+
const TargetDataRTArgs &RTArgs, bool HasNoWait);
25112511

25122512
/// Emit the arguments to be passed to the runtime library based on the
25132513
/// arrays of base pointers, pointers, sizes, map types, and mappers. If

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)