Skip to content

Commit 1ecc73e

Browse files
authored
Merge branch 'main' into main
2 parents af379ff + 8c4d661 commit 1ecc73e

File tree

625 files changed

+29762
-8906
lines changed

Some content is hidden

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

625 files changed

+29762
-8906
lines changed

clang/include/clang/Basic/BuiltinsHexagon.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ class V<string version, VFeatures newer> : VFeatures {
2020
let Features = !strconcat("v", version, "|", newer.Features);
2121
}
2222

23-
let Features = "v79" in def V79 : VFeatures;
23+
let Features = "v81" in def V81 : VFeatures;
2424

25+
def V79 : V<"79", V81>;
2526
def V75 : V<"75", V79>;
2627
def V73 : V<"73", V75>;
2728
def V71 : V<"71", V73>;
@@ -43,8 +44,9 @@ class HVXV<string version, HVXVFeatures newer> : HVXVFeatures {
4344
let Features = !strconcat("hvxv", version, "|", newer.Features);
4445
}
4546

46-
let Features = "hvxv79" in def HVXV79 : HVXVFeatures;
47+
let Features = "hvxv81" in def HVXV81 : HVXVFeatures;
4748

49+
def HVXV79 : HVXV<"79", HVXV81>;
4850
def HVXV75 : HVXV<"75", HVXV79>;
4951
def HVXV73 : HVXV<"73", HVXV75>;
5052
def HVXV71 : HVXV<"71", HVXV73>;

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,17 @@ let Features = "sse", Header = "xmmintrin.h", Attributes = [NoThrow, RequireDecl
198198
def _mm_sfence : X86LibBuiltin<"void()">;
199199
}
200200

201+
let Features = "sse", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
202+
def shufps : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Vector<4, float>, _Constant int)">;
203+
}
204+
201205
let Features = "sse", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
202206
def rcpps : X86Builtin<"_Vector<4, float>(_Vector<4, float>)">;
203207
def rcpss : X86Builtin<"_Vector<4, float>(_Vector<4, float>)">;
204208
def rsqrtps : X86Builtin<"_Vector<4, float>(_Vector<4, float>)">;
205209
def rsqrtss : X86Builtin<"_Vector<4, float>(_Vector<4, float>)">;
206210
def sqrtps : X86Builtin<"_Vector<4, float>(_Vector<4, float>)">;
207211
def sqrtss : X86Builtin<"_Vector<4, float>(_Vector<4, float>)">;
208-
def shufps : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Vector<4, float>, _Constant int)">;
209212
}
210213

211214
let Features = "sse2", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
@@ -222,13 +225,13 @@ let Features = "sse2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWi
222225
def pshufhw : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Constant int)">;
223226
def movmskpd : X86Builtin<"int(_Vector<2, double>)">;
224227
def pmovmskb128 : X86Builtin<"int(_Vector<16, char>)">;
228+
def shufpd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Vector<2, double>, _Constant int)">;
225229
}
226230

227231
let Features = "sse2", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
228232
def psadbw128 : X86Builtin<"_Vector<2, long long int>(_Vector<16, char>, _Vector<16, char>)">;
229233
def sqrtpd : X86Builtin<"_Vector<2, double>(_Vector<2, double>)">;
230234
def sqrtsd : X86Builtin<"_Vector<2, double>(_Vector<2, double>)">;
231-
def shufpd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Vector<2, double>, _Constant int)">;
232235
def cvtpd2dq : X86Builtin<"_Vector<2, long long int>(_Vector<2, double>)">;
233236
def cvtpd2ps : X86Builtin<"_Vector<4, float>(_Vector<2, double>)">;
234237
def cvttpd2dq : X86Builtin<"_Vector<4, int>(_Vector<2, double>)">;
@@ -280,8 +283,6 @@ let Features = "sse2", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] i
280283
def psllw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">;
281284
def pslld128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>)">;
282285
def psllq128 : X86Builtin<"_Vector<2, long long int>(_Vector<2, long long int>, _Vector<2, long long int>)">;
283-
def pslldqi128_byteshift : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Constant int)">;
284-
def psrldqi128_byteshift : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Constant int)">;
285286
}
286287

287288
let Features = "sse2",
@@ -300,6 +301,9 @@ let Features = "sse2",
300301

301302
def psrawi128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, int)">;
302303
def psradi128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, int)">;
304+
305+
def pslldqi128_byteshift : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Constant int)">;
306+
def psrldqi128_byteshift : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Constant int)">;
303307
}
304308

305309
let Features = "sse3", Attributes = [NoThrow] in {
@@ -487,13 +491,16 @@ let Features = "avx512f,vpclmulqdq", Attributes = [NoThrow, Const, RequiredVecto
487491
def pclmulqdq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>, _Constant char)">;
488492
}
489493

494+
let Features = "avx", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
495+
def shufpd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<4, double>, _Constant int)">;
496+
def shufps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, float>, _Constant int)">;
497+
}
498+
490499
let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
491500
def vpermilvarpd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Vector<2, long long int>)">;
492501
def vpermilvarps : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Vector<4, int>)">;
493502
def vpermilvarpd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<4, long long int>)">;
494503
def vpermilvarps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, int>)">;
495-
def shufpd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<4, double>, _Constant int)">;
496-
def shufps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, float>, _Constant int)">;
497504
def dpps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, float>, _Constant char)">;
498505
def cmppd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<4, double>, _Constant char)">;
499506
def cmpps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, float>, _Constant char)">;
@@ -607,12 +614,10 @@ let Features = "avx2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] i
607614
: X86Builtin<
608615
"_Vector<4, long long int>(_Vector<32, char>, _Vector<32, char>)">;
609616
def psllw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<8, short>)">;
610-
def pslldqi256_byteshift : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Constant int)">;
611617
def pslld256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>)">;
612618
def psllq256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<2, long long int>)">;
613619
def psraw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<8, short>)">;
614620
def psrad256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>)">;
615-
def psrldqi256_byteshift : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Constant int)">;
616621
def psrlw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<8, short>)">;
617622
def psrld256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>)">;
618623
def psrlq256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<2, long long int>)">;
@@ -646,10 +651,12 @@ let Features = "avx2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWi
646651
def psllwi256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, int)">;
647652
def pslldi256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, int)">;
648653
def psllqi256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, int)">;
654+
def pslldqi256_byteshift : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Constant int)">;
649655

650656
def psrlwi256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, int)">;
651657
def psrldi256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, int)">;
652658
def psrlqi256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, int)">;
659+
def psrldqi256_byteshift : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Constant int)">;
653660

654661
def psrawi256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, int)">;
655662
def psradi256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, int)">;
@@ -2090,6 +2097,9 @@ let Features = "avx512bw", Attributes = [NoThrow, Const, RequiredVectorWidth<512
20902097
: X86Builtin<"_Vector<32, short>(_Vector<32, short>, _Vector<8, short>)">;
20912098
def psrlw512
20922099
: X86Builtin<"_Vector<32, short>(_Vector<32, short>, _Vector<8, short>)">;
2100+
}
2101+
2102+
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
20932103
def pslldqi512_byteshift : X86Builtin<"_Vector<64, char>(_Vector<64, char>, _Constant int)">;
20942104
def psrldqi512_byteshift : X86Builtin<"_Vector<64, char>(_Vector<64, char>, _Constant int)">;
20952105
}
@@ -2470,6 +2480,9 @@ let Features = "avx512f", Attributes = [NoThrow, Const, RequiredVectorWidth<512>
24702480
def shuf_f64x2 : X86Builtin<"_Vector<8, double>(_Vector<8, double>, _Vector<8, double>, _Constant int)">;
24712481
def shuf_i32x4 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Constant int)">;
24722482
def shuf_i64x2 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>, _Constant int)">;
2483+
}
2484+
2485+
let Features = "avx512f", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
24732486
def shufpd512 : X86Builtin<"_Vector<8, double>(_Vector<8, double>, _Vector<8, double>, _Constant int)">;
24742487
def shufps512 : X86Builtin<"_Vector<16, float>(_Vector<16, float>, _Vector<16, float>, _Constant int)">;
24752488
}

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6558,6 +6558,8 @@ def mv75 : Flag<["-"], "mv75">, Group<m_hexagon_Features_Group>,
65586558
Alias<mcpu_EQ>, AliasArgs<["hexagonv75"]>;
65596559
def mv79 : Flag<["-"], "mv79">, Group<m_hexagon_Features_Group>,
65606560
Alias<mcpu_EQ>, AliasArgs<["hexagonv79"]>;
6561+
def mv81 : Flag<["-"], "mv81">, Group<m_hexagon_Features_Group>,
6562+
Alias<mcpu_EQ>, AliasArgs<["hexagonv81"]>;
65616563
def mhexagon_hvx : Flag<["-"], "mhvx">, Group<m_hexagon_Features_HVX_Group>,
65626564
HelpText<"Enable Hexagon Vector eXtensions">;
65636565
def mhexagon_hvx_EQ : Joined<["-"], "mhvx=">,

clang/lib/AST/ASTContext.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,9 @@ ASTContext::findPointerAuthContent(QualType T) const {
16481648
if (!RD)
16491649
return PointerAuthContent::None;
16501650

1651+
if (RD->isInvalidDecl())
1652+
return PointerAuthContent::None;
1653+
16511654
if (auto Existing = RecordContainsAddressDiscriminatedPointerAuth.find(RD);
16521655
Existing != RecordContainsAddressDiscriminatedPointerAuth.end())
16531656
return Existing->second;
@@ -3517,7 +3520,6 @@ static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx,
35173520
uint16_t ASTContext::getPointerAuthTypeDiscriminator(QualType T) {
35183521
assert(!T->isDependentType() &&
35193522
"cannot compute type discriminator of a dependent type");
3520-
35213523
SmallString<256> Str;
35223524
llvm::raw_svector_ostream Out(Str);
35233525

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3273,34 +3273,43 @@ bool Compiler<Emitter>::VisitCXXConstructExpr(const CXXConstructExpr *E) {
32733273
}
32743274

32753275
if (T->isArrayType()) {
3276-
const ConstantArrayType *CAT =
3277-
Ctx.getASTContext().getAsConstantArrayType(E->getType());
3278-
if (!CAT)
3279-
return false;
3280-
3281-
size_t NumElems = CAT->getZExtSize();
32823276
const Function *Func = getFunction(E->getConstructor());
32833277
if (!Func)
32843278
return false;
32853279

3286-
// FIXME(perf): We're calling the constructor once per array element here,
3287-
// in the old intepreter we had a special-case for trivial constructors.
3288-
for (size_t I = 0; I != NumElems; ++I) {
3289-
if (!this->emitConstUint64(I, E))
3290-
return false;
3291-
if (!this->emitArrayElemPtrUint64(E))
3292-
return false;
3280+
if (!this->emitDupPtr(E))
3281+
return false;
32933282

3294-
// Constructor arguments.
3295-
for (const auto *Arg : E->arguments()) {
3296-
if (!this->visit(Arg))
3297-
return false;
3283+
std::function<bool(QualType)> initArrayDimension;
3284+
initArrayDimension = [&](QualType T) -> bool {
3285+
if (!T->isArrayType()) {
3286+
// Constructor arguments.
3287+
for (const auto *Arg : E->arguments()) {
3288+
if (!this->visit(Arg))
3289+
return false;
3290+
}
3291+
3292+
return this->emitCall(Func, 0, E);
32983293
}
32993294

3300-
if (!this->emitCall(Func, 0, E))
3295+
const ConstantArrayType *CAT =
3296+
Ctx.getASTContext().getAsConstantArrayType(T);
3297+
if (!CAT)
33013298
return false;
3302-
}
3303-
return true;
3299+
QualType ElemTy = CAT->getElementType();
3300+
unsigned NumElems = CAT->getZExtSize();
3301+
for (size_t I = 0; I != NumElems; ++I) {
3302+
if (!this->emitConstUint64(I, E))
3303+
return false;
3304+
if (!this->emitArrayElemPtrUint64(E))
3305+
return false;
3306+
if (!initArrayDimension(ElemTy))
3307+
return false;
3308+
}
3309+
return this->emitPopPtr(E);
3310+
};
3311+
3312+
return initArrayDimension(E->getType());
33043313
}
33053314

33063315
return false;
@@ -3599,8 +3608,6 @@ bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) {
35993608
if (PlacementDest) {
36003609
if (!this->visit(PlacementDest))
36013610
return false;
3602-
if (!this->emitStartLifetime(E))
3603-
return false;
36043611
if (!this->emitGetLocal(SizeT, ArrayLen, E))
36053612
return false;
36063613
if (!this->emitCheckNewTypeMismatchArray(SizeT, E, E))
@@ -3740,10 +3747,9 @@ bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) {
37403747
if (PlacementDest) {
37413748
if (!this->visit(PlacementDest))
37423749
return false;
3743-
if (!this->emitStartLifetime(E))
3744-
return false;
37453750
if (!this->emitCheckNewTypeMismatch(E, E))
37463751
return false;
3752+
37473753
} else {
37483754
// Allocate just one element.
37493755
if (!this->emitAlloc(Desc, E))

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,12 +1903,19 @@ bool CheckNewTypeMismatch(InterpState &S, CodePtr OpPC, const Expr *E,
19031903
if (Ptr.inUnion() && Ptr.getBase().getRecord()->isUnion())
19041904
Ptr.activate();
19051905

1906+
if (Ptr.isZero()) {
1907+
S.FFDiag(S.Current->getSource(OpPC), diag::note_constexpr_access_null)
1908+
<< AK_Construct;
1909+
return false;
1910+
}
1911+
19061912
if (!Ptr.isBlockPointer())
19071913
return false;
19081914

1915+
startLifetimeRecurse(Ptr);
1916+
19091917
// Similar to CheckStore(), but with the additional CheckTemporary() call and
19101918
// the AccessKinds are different.
1911-
19121919
if (!Ptr.block()->isAccessible()) {
19131920
if (!CheckExtern(S, OpPC, Ptr))
19141921
return false;

0 commit comments

Comments
 (0)