Skip to content

Commit eb8752f

Browse files
committed
merge main into amd-staging
2 parents edf06d7 + e5f499f commit eb8752f

File tree

231 files changed

+14034
-12184
lines changed

Some content is hidden

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

231 files changed

+14034
-12184
lines changed

.github/CODEOWNERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@
6060
/mlir/lib/Conversion/*ToROCDL @krzysz00 @kuhar
6161
/mlir/include/mlir/Dialect/LLVMIR/ROCDL* @krzysz00 @kuhar
6262

63+
# XeGPU and XeVM dialects in MLIR.
64+
/mlir/include/mlir/Dialect/XeGPU @charithaintc @Jianhui-Li
65+
/mlir/lib/Dialect/XeGPU @charithaintc @Jianhui-Li
66+
/mlir/lib/Conversion/*XeGPU* @charithaintc @Jianhui-Li
67+
/mlir/include/mlir/Dialect/XeGPU/Transforms @charithaintc @Jianhui-Li
68+
/mlir/lib/Dialect/XeGPU/Transforms @charithaintc @Jianhui-Li
69+
/mlir/include/mlir/Dialect/LLVMIR/XeVM* @silee2
70+
/mlir/lib/Dialect/LLVMIR/IR/XeVM @silee2
71+
/mlir/lib/Conversion/*XeVM* @silee2
72+
6373
# Bufferization Dialect in MLIR.
6474
/mlir/include/mlir/Dialect/Bufferization @matthias-springer
6575
/mlir/lib/Dialect/Bufferization @matthias-springer

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
InheritParentConfig: true
2+
HeaderFilterRegex: 'clang-tools-extra/clang-tidy'
3+
ExcludeHeaderFilterRegex: 'include-cleaner|clang-query'
24
Checks: >
35
bugprone-*,
46
-bugprone-assignment-in-if-condition,

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,8 @@ Improvements to Clang's diagnostics
602602
Moved the warning for a missing (though implied) attribute on a redeclaration into this group.
603603
Added a new warning in this group for the case where the attribute is missing/implicit on
604604
an override of a virtual method.
605+
- Remove ``-Wperf-constraint-implies-noexcept`` from ``-Wall``. This warning is somewhat nit-picky and
606+
attempts to resolve it, by adding ``noexcept``, can create new ways for programs to crash. (#GH167540)
605607
- Implemented diagnostics when retrieving the tuple size for types where its specialization of `std::tuple_size`
606608
produces an invalid size (either negative or greater than the implementation limit). (#GH159563)
607609
- Fixed fix-it hint for fold expressions. Clang now correctly places the suggested right

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ def Consumed : DiagGroup<"consumed">;
13121312
// DefaultIgnore in addition to putting it here.
13131313
def All : DiagGroup<"all", [Most, Parentheses, Switch, SwitchBool,
13141314
MisleadingIndentation, PackedNonPod,
1315-
VLACxxExtension, PerfConstraintImpliesNoexcept]>;
1315+
VLACxxExtension]>;
13161316

13171317
// Warnings that should be in clang-cl /w4.
13181318
def : DiagGroup<"CL4", [All, Extra]>;

clang/include/clang/Basic/OpenMPKinds.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ OPENMP_DEVICE_MODIFIER(device_num)
127127
// Variable-category attributes for 'default' clause.
128128
OPENMP_DEFAULT_VARIABLE_CATEGORY(aggregate)
129129
OPENMP_DEFAULT_VARIABLE_CATEGORY(all)
130-
OPENMP_DEFAULT_VARIABLE_CATEGORY(allocatable)
131130
OPENMP_DEFAULT_VARIABLE_CATEGORY(pointer)
132131
OPENMP_DEFAULT_VARIABLE_CATEGORY(scalar)
133132

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,49 @@ RValue CIRGenFunction::emitLoadOfLValue(LValue lv, SourceLocation loc) {
631631
lv.getVectorIdx()));
632632
}
633633

634+
if (lv.isExtVectorElt())
635+
return emitLoadOfExtVectorElementLValue(lv);
636+
634637
cgm.errorNYI(loc, "emitLoadOfLValue");
635638
return RValue::get(nullptr);
636639
}
637640

641+
int64_t CIRGenFunction::getAccessedFieldNo(unsigned int idx,
642+
const mlir::ArrayAttr elts) {
643+
auto elt = mlir::cast<mlir::IntegerAttr>(elts[idx]);
644+
return elt.getInt();
645+
}
646+
647+
// If this is a reference to a subset of the elements of a vector, create an
648+
// appropriate shufflevector.
649+
RValue CIRGenFunction::emitLoadOfExtVectorElementLValue(LValue lv) {
650+
mlir::Location loc = lv.getExtVectorPointer().getLoc();
651+
mlir::Value vec = builder.createLoad(loc, lv.getExtVectorAddress());
652+
653+
// HLSL allows treating scalars as one-element vectors. Converting the scalar
654+
// IR value to a vector here allows the rest of codegen to behave as normal.
655+
if (getLangOpts().HLSL && !mlir::isa<cir::VectorType>(vec.getType())) {
656+
cgm.errorNYI(loc, "emitLoadOfExtVectorElementLValue: HLSL");
657+
return {};
658+
}
659+
660+
const mlir::ArrayAttr elts = lv.getExtVectorElts();
661+
662+
// If the result of the expression is a non-vector type, we must be extracting
663+
// a single element. Just codegen as an extractelement.
664+
const auto *exprVecTy = lv.getType()->getAs<clang::VectorType>();
665+
if (!exprVecTy) {
666+
int64_t indexValue = getAccessedFieldNo(0, elts);
667+
cir::ConstantOp index =
668+
builder.getConstInt(loc, builder.getSInt64Ty(), indexValue);
669+
return RValue::get(cir::VecExtractOp::create(builder, loc, vec, index));
670+
}
671+
672+
cgm.errorNYI(
673+
loc, "emitLoadOfExtVectorElementLValue: Result of expr is vector type");
674+
return {};
675+
}
676+
638677
static cir::FuncOp emitFunctionDeclPointer(CIRGenModule &cgm, GlobalDecl gd) {
639678
assert(!cir::MissingFeatures::weakRefReference());
640679
return cgm.getAddrOfFunction(gd);
@@ -1120,6 +1159,46 @@ CIRGenFunction::emitArraySubscriptExpr(const clang::ArraySubscriptExpr *e) {
11201159
return lv;
11211160
}
11221161

1162+
LValue CIRGenFunction::emitExtVectorElementExpr(const ExtVectorElementExpr *e) {
1163+
// Emit the base vector as an l-value.
1164+
LValue base;
1165+
1166+
// ExtVectorElementExpr's base can either be a vector or pointer to vector.
1167+
if (e->isArrow()) {
1168+
cgm.errorNYI(e->getSourceRange(),
1169+
"emitExtVectorElementExpr: pointer to vector");
1170+
return {};
1171+
} else if (e->getBase()->isGLValue()) {
1172+
// Otherwise, if the base is an lvalue ( as in the case of foo.x.x),
1173+
// emit the base as an lvalue.
1174+
assert(e->getBase()->getType()->isVectorType());
1175+
base = emitLValue(e->getBase());
1176+
} else {
1177+
// Otherwise, the base is a normal rvalue (as in (V+V).x), emit it as such.
1178+
cgm.errorNYI(e->getSourceRange(),
1179+
"emitExtVectorElementExpr: base is a normal rvalue");
1180+
return {};
1181+
}
1182+
1183+
QualType type =
1184+
e->getType().withCVRQualifiers(base.getQuals().getCVRQualifiers());
1185+
1186+
// Encode the element access list into a vector of unsigned indices.
1187+
SmallVector<uint32_t, 4> indices;
1188+
e->getEncodedElementAccess(indices);
1189+
1190+
if (base.isSimple()) {
1191+
SmallVector<int64_t> attrElts(indices.begin(), indices.end());
1192+
mlir::ArrayAttr elts = builder.getI64ArrayAttr(attrElts);
1193+
return LValue::makeExtVectorElt(base.getAddress(), elts, type,
1194+
base.getBaseInfo());
1195+
}
1196+
1197+
cgm.errorNYI(e->getSourceRange(),
1198+
"emitExtVectorElementExpr: isSimple is false");
1199+
return {};
1200+
}
1201+
11231202
LValue CIRGenFunction::emitStringLiteralLValue(const StringLiteral *e,
11241203
llvm::StringRef name) {
11251204
cir::GlobalOp globalOp = cgm.getGlobalForStringLiteral(e, name);

clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,9 @@ void AggExprEmitter::visitCXXParenListOrInitListExpr(
839839
}
840840
}
841841

842+
// Prepare a 'this' for CXXDefaultInitExprs.
843+
CIRGenFunction::FieldConstructionScope fcScope(cgf, dest.getAddress());
844+
842845
LValue destLV = cgf.makeAddrLValue(dest.getAddress(), e->getType());
843846

844847
if (record->isUnion()) {

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
199199
return emitNullValue(e->getType(), cgf.getLoc(e->getSourceRange()));
200200
}
201201

202+
mlir::Value VisitGNUNullExpr(const GNUNullExpr *e) {
203+
return emitNullValue(e->getType(), cgf.getLoc(e->getSourceRange()));
204+
}
205+
202206
mlir::Value VisitOpaqueValueExpr(OpaqueValueExpr *e) {
203207
if (e->isGLValue())
204208
return emitLoadOfLValue(cgf.getOrCreateOpaqueLValueMapping(e),
@@ -279,6 +283,8 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
279283
e->getSourceRange().getBegin());
280284
}
281285

286+
mlir::Value VisitExtVectorElementExpr(Expr *e) { return emitLoadOfLValue(e); }
287+
282288
mlir::Value VisitMemberExpr(MemberExpr *e);
283289

284290
mlir::Value VisitCompoundLiteralExpr(CompoundLiteralExpr *e) {

clang/lib/CIR/CodeGen/CIRGenFunction.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,8 @@ LValue CIRGenFunction::emitLValue(const Expr *e) {
887887
return emitConditionalOperatorLValue(cast<BinaryConditionalOperator>(e));
888888
case Expr::ArraySubscriptExprClass:
889889
return emitArraySubscriptExpr(cast<ArraySubscriptExpr>(e));
890+
case Expr::ExtVectorElementExprClass:
891+
return emitExtVectorElementExpr(cast<ExtVectorElementExpr>(e));
890892
case Expr::UnaryOperatorClass:
891893
return emitUnaryOpLValue(cast<UnaryOperator>(e));
892894
case Expr::StringLiteralClass:

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,8 @@ class CIRGenFunction : public CIRGenTypeCache {
12771277
QualType &baseType, Address &addr);
12781278
LValue emitArraySubscriptExpr(const clang::ArraySubscriptExpr *e);
12791279

1280+
LValue emitExtVectorElementExpr(const ExtVectorElementExpr *e);
1281+
12801282
Address emitArrayToPointerDecay(const Expr *e,
12811283
LValueBaseInfo *baseInfo = nullptr);
12821284

@@ -1342,6 +1344,8 @@ class CIRGenFunction : public CIRGenTypeCache {
13421344
mlir::Value emittedE,
13431345
bool isDynamic);
13441346

1347+
int64_t getAccessedFieldNo(unsigned idx, mlir::ArrayAttr elts);
1348+
13451349
RValue emitCall(const CIRGenFunctionInfo &funcInfo,
13461350
const CIRGenCallee &callee, ReturnValueSlot returnValue,
13471351
const CallArgList &args, cir::CIRCallOpInterface *callOp,
@@ -1637,6 +1641,8 @@ class CIRGenFunction : public CIRGenTypeCache {
16371641
/// Load a complex number from the specified l-value.
16381642
mlir::Value emitLoadOfComplex(LValue src, SourceLocation loc);
16391643

1644+
RValue emitLoadOfExtVectorElementLValue(LValue lv);
1645+
16401646
/// Given an expression that represents a value lvalue, this method emits
16411647
/// the address of the lvalue, then loads the result as an rvalue,
16421648
/// returning the rvalue.

0 commit comments

Comments
 (0)