Skip to content

Commit 4b7c63e

Browse files
author
iclsrc
committed
Merge from 'main' to 'sycl-web' (23 commits)
CONFLICT (content): Merge conflict in llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
2 parents dcb6599 + 6bcff9e commit 4b7c63e

File tree

104 files changed

+4293
-6171
lines changed

Some content is hidden

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

104 files changed

+4293
-6171
lines changed

.github/workflows/containers/github-action-ci-windows/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ RUN powershell -Command \
9090
RUN git config --system core.longpaths true & \
9191
git config --global core.autocrlf false
9292
93-
ARG RUNNER_VERSION=2.327.0
93+
ARG RUNNER_VERSION=2.327.1
9494
ENV RUNNER_VERSION=$RUNNER_VERSION
9595
9696
RUN powershell -Command \

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ WORKDIR /home/gha
9494

9595
FROM ci-container as ci-container-agent
9696

97-
ENV GITHUB_RUNNER_VERSION=2.327.0
97+
ENV GITHUB_RUNNER_VERSION=2.327.1
9898

9999
RUN mkdir actions-runner && \
100100
cd actions-runner && \

.github/workflows/libcxx-build-containers.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ jobs:
3434

3535
- name: Build the Linux builder image
3636
working-directory: libcxx/utils/ci
37-
run: docker compose build actions-builder
37+
run: |
38+
docker compose build builder-base
39+
docker compose build actions-builder
3840
env:
3941
TAG: ${{ github.sha }}
4042

@@ -55,6 +57,7 @@ jobs:
5557
if: github.event_name == 'push'
5658
working-directory: libcxx/utils/ci
5759
run: |
60+
docker compose push builder-base
5861
docker compose push actions-builder
5962
env:
6063
TAG: ${{ github.sha }}

clang-tools-extra/clang-tidy/llvm/UseNewMLIROpBuilderCheck.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,23 @@ EditGenerator rewrite(RangeSelector Call, RangeSelector Builder,
111111
}
112112

113113
RewriteRuleWith<std::string> useNewMlirOpBuilderCheckRule() {
114-
return makeRule(
114+
Stencil message = cat("use 'OpType::create(builder, ...)' instead of "
115+
"'builder.create<OpType>(...)'");
116+
// Match a create call on an OpBuilder.
117+
ast_matchers::internal::Matcher<Stmt> base =
115118
cxxMemberCallExpr(
116119
on(expr(hasType(
117120
cxxRecordDecl(isSameOrDerivedFrom("::mlir::OpBuilder"))))
118121
.bind("builder")),
119122
callee(cxxMethodDecl(hasTemplateArgument(0, templateArgument()))),
120123
callee(cxxMethodDecl(hasName("create"))))
121-
.bind("call"),
122-
rewrite(node("call"), node("builder"), callArgs("call")),
123-
cat("use 'OpType::create(builder, ...)' instead of "
124-
"'builder.create<OpType>(...)'"));
124+
.bind("call");
125+
return applyFirst(
126+
// Attempt rewrite given an lvalue builder, else just warn.
127+
{makeRule(cxxMemberCallExpr(unless(on(cxxTemporaryObjectExpr())), base),
128+
rewrite(node("call"), node("builder"), callArgs("call")),
129+
message),
130+
makeRule(base, noopEdit(node("call")), message)});
125131
}
126132
} // namespace
127133

clang-tools-extra/test/clang-tidy/checkers/llvm/use-new-mlir-op-builder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,8 @@ void f() {
6969
// CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use 'OpType::create(builder, ...)' instead of 'builder.create<OpType>(...)' [llvm-use-new-mlir-op-builder]
7070
// CHECK-FIXES: mlir::ModuleOp::create(ib)
7171
ib.create<mlir::ModuleOp>( );
72+
73+
// CHECK-MESSAGES: :[[@LINE+2]]:3: warning: use 'OpType::create(builder, ...)' instead of 'builder.create<OpType>(...)' [llvm-use-new-mlir-op-builder]
74+
// CHECK-FIXES: mlir::OpBuilder().create<mlir::ModuleOp>(builder.getUnknownLoc());
75+
mlir::OpBuilder().create<mlir::ModuleOp>(builder.getUnknownLoc());
7276
}

clang/docs/LanguageExtensions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ It can be used like this:
6868
``__has_builtin`` should not be used to detect support for a builtin macro;
6969
use ``#ifdef`` instead.
7070

71+
When compiling with target offloading, ``__has_builtin`` only considers the
72+
currently active target.
73+
7174
``__has_constexpr_builtin``
7275
---------------------------
7376

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Potentially Breaking Changes
3737
C/C++ Language Potentially Breaking Changes
3838
-------------------------------------------
3939

40+
- The ``__has_builtin`` function now only considers the currently active target when being used with target offloading.
41+
4042
C++ Specific Potentially Breaking Changes
4143
-----------------------------------------
4244
- For C++20 modules, the Reduced BMI mode will be the default option. This may introduce

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,6 @@ LValue CIRGenFunction::emitCastLValue(const CastExpr *e) {
949949
case CK_Dynamic:
950950
case CK_ToUnion:
951951
case CK_BaseToDerived:
952-
case CK_LValueBitCast:
953952
case CK_AddressSpaceConversion:
954953
case CK_ObjCObjectLValueCast:
955954
case CK_VectorSplat:
@@ -965,6 +964,18 @@ LValue CIRGenFunction::emitCastLValue(const CastExpr *e) {
965964
return {};
966965
}
967966

967+
case CK_LValueBitCast: {
968+
// This must be a reinterpret_cast (or c-style equivalent).
969+
const auto *ce = cast<ExplicitCastExpr>(e);
970+
971+
cgm.emitExplicitCastExprType(ce, this);
972+
LValue LV = emitLValue(e->getSubExpr());
973+
Address V = LV.getAddress().withElementType(
974+
builder, convertTypeForMem(ce->getTypeAsWritten()->getPointeeType()));
975+
976+
return makeAddrLValue(V, e->getType(), LV.getBaseInfo());
977+
}
978+
968979
case CK_NoOp: {
969980
// CK_NoOp can model a qualification conversion, which can remove an array
970981
// bound and change the IR type.

clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,11 @@ mlir::Value ComplexExprEmitter::emitCast(CastKind ck, Expr *op,
189189
}
190190

191191
case CK_LValueBitCast: {
192-
cgf.cgm.errorNYI("ComplexExprEmitter::emitCast CK_LValueBitCast");
193-
return {};
192+
LValue origLV = cgf.emitLValue(op);
193+
Address addr =
194+
origLV.getAddress().withElementType(builder, cgf.convertType(destTy));
195+
LValue destLV = cgf.makeAddrLValue(addr, destTy);
196+
return emitLoadOfLValue(destLV, op->getExprLoc());
194197
}
195198

196199
case CK_LValueToRValueBitCast: {

clang/lib/CIR/CodeGen/CIRGenFunction.cpp

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,4 +923,130 @@ CIRGenFunction::emitArrayLength(const clang::ArrayType *origArrayType,
923923
return builder.getConstInt(*currSrcLoc, SizeTy, countFromCLAs);
924924
}
925925

926+
// TODO(cir): Most of this function can be shared between CIRGen
927+
// and traditional LLVM codegen
928+
void CIRGenFunction::emitVariablyModifiedType(QualType type) {
929+
assert(type->isVariablyModifiedType() &&
930+
"Must pass variably modified type to EmitVLASizes!");
931+
932+
// We're going to walk down into the type and look for VLA
933+
// expressions.
934+
do {
935+
assert(type->isVariablyModifiedType());
936+
937+
const Type *ty = type.getTypePtr();
938+
switch (ty->getTypeClass()) {
939+
case Type::CountAttributed:
940+
case Type::PackIndexing:
941+
case Type::ArrayParameter:
942+
case Type::HLSLAttributedResource:
943+
case Type::HLSLInlineSpirv:
944+
case Type::PredefinedSugar:
945+
cgm.errorNYI("CIRGenFunction::emitVariablyModifiedType");
946+
947+
#define TYPE(Class, Base)
948+
#define ABSTRACT_TYPE(Class, Base)
949+
#define NON_CANONICAL_TYPE(Class, Base)
950+
#define DEPENDENT_TYPE(Class, Base) case Type::Class:
951+
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base)
952+
#include "clang/AST/TypeNodes.inc"
953+
llvm_unreachable(
954+
"dependent type must be resolved before the CIR codegen");
955+
956+
// These types are never variably-modified.
957+
case Type::Builtin:
958+
case Type::Complex:
959+
case Type::Vector:
960+
case Type::ExtVector:
961+
case Type::ConstantMatrix:
962+
case Type::Record:
963+
case Type::Enum:
964+
case Type::Using:
965+
case Type::TemplateSpecialization:
966+
case Type::ObjCTypeParam:
967+
case Type::ObjCObject:
968+
case Type::ObjCInterface:
969+
case Type::ObjCObjectPointer:
970+
case Type::BitInt:
971+
llvm_unreachable("type class is never variably-modified!");
972+
973+
case Type::Elaborated:
974+
type = cast<clang::ElaboratedType>(ty)->getNamedType();
975+
break;
976+
977+
case Type::Adjusted:
978+
type = cast<clang::AdjustedType>(ty)->getAdjustedType();
979+
break;
980+
981+
case Type::Decayed:
982+
type = cast<clang::DecayedType>(ty)->getPointeeType();
983+
break;
984+
985+
case Type::Pointer:
986+
type = cast<clang::PointerType>(ty)->getPointeeType();
987+
break;
988+
989+
case Type::BlockPointer:
990+
type = cast<clang::BlockPointerType>(ty)->getPointeeType();
991+
break;
992+
993+
case Type::LValueReference:
994+
case Type::RValueReference:
995+
type = cast<clang::ReferenceType>(ty)->getPointeeType();
996+
break;
997+
998+
case Type::MemberPointer:
999+
type = cast<clang::MemberPointerType>(ty)->getPointeeType();
1000+
break;
1001+
1002+
case Type::ConstantArray:
1003+
case Type::IncompleteArray:
1004+
// Losing element qualification here is fine.
1005+
type = cast<clang::ArrayType>(ty)->getElementType();
1006+
break;
1007+
1008+
case Type::VariableArray: {
1009+
cgm.errorNYI("CIRGenFunction::emitVariablyModifiedType VLA");
1010+
break;
1011+
}
1012+
1013+
case Type::FunctionProto:
1014+
case Type::FunctionNoProto:
1015+
type = cast<clang::FunctionType>(ty)->getReturnType();
1016+
break;
1017+
1018+
case Type::Paren:
1019+
case Type::TypeOf:
1020+
case Type::UnaryTransform:
1021+
case Type::Attributed:
1022+
case Type::BTFTagAttributed:
1023+
case Type::SubstTemplateTypeParm:
1024+
case Type::MacroQualified:
1025+
// Keep walking after single level desugaring.
1026+
type = type.getSingleStepDesugaredType(getContext());
1027+
break;
1028+
1029+
case Type::Typedef:
1030+
case Type::Decltype:
1031+
case Type::Auto:
1032+
case Type::DeducedTemplateSpecialization:
1033+
// Stop walking: nothing to do.
1034+
return;
1035+
1036+
case Type::TypeOfExpr:
1037+
// Stop walking: emit typeof expression.
1038+
emitIgnoredExpr(cast<clang::TypeOfExprType>(ty)->getUnderlyingExpr());
1039+
return;
1040+
1041+
case Type::Atomic:
1042+
type = cast<clang::AtomicType>(ty)->getValueType();
1043+
break;
1044+
1045+
case Type::Pipe:
1046+
type = cast<clang::PipeType>(ty)->getElementType();
1047+
break;
1048+
}
1049+
} while (type->isVariablyModifiedType());
1050+
}
1051+
9261052
} // namespace clang::CIRGen

0 commit comments

Comments
 (0)