Skip to content

Commit 3f38a6a

Browse files
committed
merge main into amd-staging
2 parents cca5f2a + 128e2e4 commit 3f38a6a

File tree

192 files changed

+5428
-3561
lines changed

Some content is hidden

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

192 files changed

+5428
-3561
lines changed

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ if(FUCHSIA_SDK)
300300
set(LLVM_RUNTIME_MULTILIB_hwasan+noexcept_TARGETS "aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
301301
endif()
302302

303-
foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.main-none-eabi;aarch64-none-elf)
303+
foreach(target armv6m-none-eabi;armv7m-none-eabi;armv7em-none-eabi;armv8m.main-none-eabi;armv8.1m.main-none-eabi;aarch64-none-elf)
304304
list(APPEND BUILTIN_TARGETS "${target}")
305305
set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
306306
set(BUILTINS_${target}_CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")

clang/include/clang/AST/Type.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8841,13 +8841,16 @@ void FixedPointValueToString(SmallVectorImpl<char> &Str, llvm::APSInt Val,
88418841
unsigned Scale);
88428842

88438843
inline FunctionEffectsRef FunctionEffectsRef::get(QualType QT) {
8844+
const Type *TypePtr = QT.getTypePtr();
88448845
while (true) {
8845-
QualType Pointee = QT->getPointeeType();
8846-
if (Pointee.isNull())
8846+
if (QualType Pointee = TypePtr->getPointeeType(); !Pointee.isNull())
8847+
TypePtr = Pointee.getTypePtr();
8848+
else if (TypePtr->isArrayType())
8849+
TypePtr = TypePtr->getBaseElementTypeUnsafe();
8850+
else
88478851
break;
8848-
QT = Pointee;
88498852
}
8850-
if (const auto *FPT = QT->getAs<FunctionProtoType>())
8853+
if (const auto *FPT = TypePtr->getAs<FunctionProtoType>())
88518854
return FPT->getFunctionEffects();
88528855
return {};
88538856
}

clang/include/clang/AST/TypeLoc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ class ConcreteTypeLoc : public Base {
397397
unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
398398
size = llvm::alignTo(size, extraAlign);
399399
size += asDerived()->getExtraLocalDataSize();
400+
size = llvm::alignTo(size, asDerived()->getLocalDataAlignment());
400401
return size;
401402
}
402403

clang/include/clang/Basic/BuiltinsSPIRV.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ def SPIRVDistance : Builtin {
1313
let Attributes = [NoThrow, Const];
1414
let Prototype = "void(...)";
1515
}
16+
17+
def SPIRVLength : Builtin {
18+
let Spellings = ["__builtin_spirv_length"];
19+
let Attributes = [NoThrow, Const];
20+
let Prototype = "void(...)";
21+
}

clang/include/clang/Basic/BuiltinsX86_64.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ let Features = "amx-complex,amx-transpose", Attributes = [NoThrow] in {
295295

296296
let Features = "amx-avx512,avx10.2-512", Attributes = [NoThrow] in {
297297
def tcvtrowd2ps_internal : X86Builtin<"_Vector<16, float>(unsigned short, unsigned short, _Vector<256, int>, unsigned int)">;
298-
def tcvtrowps2pbf16h_internal : X86Builtin<"_Vector<32, __bf16>(unsigned short, unsigned short, _Vector<256, int>, unsigned int)">;
299-
def tcvtrowps2pbf16l_internal : X86Builtin<"_Vector<32, __bf16>(unsigned short, unsigned short, _Vector<256, int>, unsigned int)">;
298+
def tcvtrowps2bf16h_internal : X86Builtin<"_Vector<32, __bf16>(unsigned short, unsigned short, _Vector<256, int>, unsigned int)">;
299+
def tcvtrowps2bf16l_internal : X86Builtin<"_Vector<32, __bf16>(unsigned short, unsigned short, _Vector<256, int>, unsigned int)">;
300300
def tcvtrowps2phh_internal : X86Builtin<"_Vector<32, _Float16>(unsigned short, unsigned short, _Vector<256, int>, unsigned int)">;
301301
def tcvtrowps2phl_internal : X86Builtin<"_Vector<32, _Float16>(unsigned short, unsigned short, _Vector<256, int>, unsigned int)">;
302302
def tilemovrow_internal : X86Builtin<"_Vector<16, int>(unsigned short, unsigned short, _Vector<256, int>, unsigned int)">;
@@ -387,8 +387,8 @@ let Features = "amx-complex,amx-transpose", Attributes = [NoThrow] in {
387387

388388
let Features = "amx-avx512,avx10.2-512", Attributes = [NoThrow] in {
389389
def tcvtrowd2ps : X86Builtin<"_Vector<16, float>(_Constant unsigned char, unsigned int)">;
390-
def tcvtrowps2pbf16h : X86Builtin<"_Vector<32, __bf16>(_Constant unsigned char, unsigned int)">;
391-
def tcvtrowps2pbf16l : X86Builtin<"_Vector<32, __bf16>(_Constant unsigned char, unsigned int)">;
390+
def tcvtrowps2bf16h : X86Builtin<"_Vector<32, __bf16>(_Constant unsigned char, unsigned int)">;
391+
def tcvtrowps2bf16l : X86Builtin<"_Vector<32, __bf16>(_Constant unsigned char, unsigned int)">;
392392
def tcvtrowps2phh : X86Builtin<"_Vector<32, _Float16>(_Constant unsigned char, unsigned int)">;
393393
def tcvtrowps2phl : X86Builtin<"_Vector<32, _Float16>(_Constant unsigned char, unsigned int)">;
394394
def tilemovrow : X86Builtin<"_Vector<16, int>(_Constant unsigned char, unsigned int)">;

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ bool Compiler<Emitter>::VisitUnaryExprOrTypeTraitExpr(
20662066
Size = CharUnits::One();
20672067
else {
20682068
if (ArgType->isDependentType() || !ArgType->isConstantSizeType())
2069-
return false;
2069+
return this->emitInvalid(E);
20702070

20712071
if (Kind == UETT_SizeOf)
20722072
Size = ASTCtx.getTypeSizeInChars(ArgType);
@@ -6210,8 +6210,20 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
62106210
return revisit(VD);
62116211

62126212
if ((VD->hasGlobalStorage() || VD->isStaticDataMember()) &&
6213-
typeShouldBeVisited(VD->getType()))
6213+
typeShouldBeVisited(VD->getType())) {
6214+
if (const Expr *Init = VD->getAnyInitializer();
6215+
Init && !Init->isValueDependent()) {
6216+
// Whether or not the evaluation is successul doesn't really matter
6217+
// here -- we will create a global variable in any case, and that
6218+
// will have the state of initializer evaluation attached.
6219+
APValue V;
6220+
SmallVector<PartialDiagnosticAt> Notes;
6221+
(void)Init->EvaluateAsInitializer(V, Ctx.getASTContext(), VD, Notes,
6222+
true);
6223+
return this->visitDeclRef(D, E);
6224+
}
62146225
return revisit(VD);
6226+
}
62156227

62166228
// FIXME: The evaluateValue() check here is a little ridiculous, since
62176229
// it will ultimately call into Context::evaluateAsInitializer(). In

clang/lib/AST/ByteCode/EvaluationResult.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ bool EvaluationResult::checkFullyInitialized(InterpState &S,
160160
return true;
161161

162162
SourceLocation InitLoc;
163-
if (const auto *D = Source.dyn_cast<const Decl *>())
163+
if (const auto *D = dyn_cast<const Decl *>(Source))
164164
InitLoc = cast<VarDecl>(D)->getAnyInitializer()->getExprLoc();
165-
else if (const auto *E = Source.dyn_cast<const Expr *>())
165+
else if (const auto *E = dyn_cast<const Expr *>(Source))
166166
InitLoc = E->getExprLoc();
167167

168168
if (const Record *R = Ptr.getRecord())

clang/lib/AST/VTableBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,8 +3831,8 @@ const VirtualBaseInfo &MicrosoftVTableContext::computeVBTableRelatedInformation(
38313831
unsigned VBTableIndex = 1 + VBI->VBTableIndices.size();
38323832
for (const auto &VB : RD->vbases()) {
38333833
const CXXRecordDecl *CurVBase = VB.getType()->getAsCXXRecordDecl();
3834-
if (!VBI->VBTableIndices.count(CurVBase))
3835-
VBI->VBTableIndices[CurVBase] = VBTableIndex++;
3834+
if (VBI->VBTableIndices.try_emplace(CurVBase, VBTableIndex).second)
3835+
++VBTableIndex;
38363836
}
38373837

38383838
return *VBI;

clang/lib/Analysis/ExprMutationAnalyzer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ AST_MATCHER_P(Stmt, canResolveToExpr, const Stmt *, Inner) {
104104
AST_MATCHER_P(InitListExpr, hasAnyInit, ast_matchers::internal::Matcher<Expr>,
105105
InnerMatcher) {
106106
for (const Expr *Arg : Node.inits()) {
107+
if (Arg == nullptr)
108+
continue;
107109
ast_matchers::internal::BoundNodesTreeBuilder Result(*Builder);
108110
if (InnerMatcher.matches(*Arg, Finder, &Result)) {
109111
*Builder = std::move(Result);

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20525,6 +20525,16 @@ Value *CodeGenFunction::EmitSPIRVBuiltinExpr(unsigned BuiltinID,
2052520525
/*ReturnType=*/X->getType()->getScalarType(), Intrinsic::spv_distance,
2052620526
ArrayRef<Value *>{X, Y}, nullptr, "spv.distance");
2052720527
}
20528+
case SPIRV::BI__builtin_spirv_length: {
20529+
Value *X = EmitScalarExpr(E->getArg(0));
20530+
assert(E->getArg(0)->getType()->hasFloatingRepresentation() &&
20531+
"length operand must have a float representation");
20532+
assert(E->getArg(0)->getType()->isVectorType() &&
20533+
"length operand must be a vector");
20534+
return Builder.CreateIntrinsic(
20535+
/*ReturnType=*/X->getType()->getScalarType(), Intrinsic::spv_length,
20536+
ArrayRef<Value *>{X}, nullptr, "spv.length");
20537+
}
2052820538
}
2052920539
return nullptr;
2053020540
}

0 commit comments

Comments
 (0)