Skip to content

Commit a95725f

Browse files
committed
fix wrong function name
Created using spr 1.3.8-beta.1
2 parents 636de50 + f21a39e commit a95725f

File tree

164 files changed

+3690
-4391
lines changed

Some content is hidden

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

164 files changed

+3690
-4391
lines changed

.ci/all_requirements.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ ml-dtypes==0.5.1 ; python_version < "3.13" \
194194
--hash=sha256:d13755f8e8445b3870114e5b6240facaa7cb0c3361e54beba3e07fa912a6e12b \
195195
--hash=sha256:fd918d4e6a4e0c110e2e05be7a7814d10dc1b95872accbf6512b80a109b71ae1
196196
# via -r mlir/python/requirements.txt
197-
nanobind==2.7.0 \
198-
--hash=sha256:73b12d0e751d140d6c1bf4b215e18818a8debfdb374f08dc3776ad208d808e74 \
199-
--hash=sha256:f9f1b160580c50dcf37b6495a0fd5ec61dc0d95dae5f8004f87dd9ad7eb46b34
197+
nanobind==2.9.2 \
198+
--hash=sha256:c37957ffd5eac7eda349cff3622ecd32e5ee1244ecc912c99b5bc8188bafd16e \
199+
--hash=sha256:e7608472de99d375759814cab3e2c94aba3f9ec80e62cfef8ced495ca5c27d6e
200200
# via -r mlir/python/requirements.txt
201201
numpy==2.0.2 \
202202
--hash=sha256:0123ffdaa88fa4ab64835dcbde75dcdf89c453c922f18dced6e27c90d1d0ec5a \
@@ -383,6 +383,10 @@ swig==4.3.1 \
383383
--hash=sha256:efec16327029f682f649a26da726bb0305be8800bd0f1fa3e81bf0769cf5b476 \
384384
--hash=sha256:fc496c0d600cf1bb2d91e28d3d6eae9c4301e5ea7a0dec5a4281b5efed4245a8
385385
# via -r lldb/test/requirements.txt
386+
typing-extensions==4.15.0 \
387+
--hash=sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466 \
388+
--hash=sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548
389+
# via -r mlir/python/requirements.txt
386390
urllib3==2.5.0 \
387391
--hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \
388392
--hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc

clang-tools-extra/clang-tidy/custom/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ if(CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS)
99
QueryCheck.cpp
1010

1111
LINK_LIBS
12+
clangQuery
1213
clangTidy
1314
clangTidyBugproneModule
1415
clangTidyMiscModule
@@ -31,7 +32,6 @@ if(CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS)
3132
clangDynamicASTMatchers
3233
clangFrontend
3334
clangLex
34-
clangQuery
3535
clangSerialization
3636
clangTooling
3737
)

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4131,6 +4131,45 @@ def CIR_ThrowOp : CIR_Op<"throw"> {
41314131
// Atomic operations
41324132
//===----------------------------------------------------------------------===//
41334133

4134+
def CIR_AtomicXchg : CIR_Op<"atomic.xchg", [
4135+
AllTypesMatch<["result", "val"]>,
4136+
TypesMatchWith<"type of 'val' must match the pointee type of 'ptr'",
4137+
"ptr", "val", "mlir::cast<cir::PointerType>($_self).getPointee()">
4138+
]> {
4139+
let summary = "Atomic exchange";
4140+
let description = [{
4141+
C/C++ atomic exchange operation. This operation implements the C/C++
4142+
builtin function `__atomic_exchange`, `__atomic_exchange_n`, and
4143+
`__c11_atomic_exchange`.
4144+
4145+
This operation takes two arguments: a pointer `ptr` and a value `val`. The
4146+
operation atomically replaces the value of the object pointed-to by `ptr`
4147+
with `val`, and returns the original value of the object.
4148+
4149+
Example:
4150+
4151+
```mlir
4152+
%res = cir.atomic.xchg(%ptr : !cir.ptr<!u64i>,
4153+
%val : !u64i,
4154+
seq_cst) : !u64i
4155+
```
4156+
}];
4157+
4158+
let results = (outs CIR_AnyType:$result);
4159+
let arguments = (ins
4160+
Arg<CIR_PointerType, "", [MemRead, MemWrite]>:$ptr,
4161+
CIR_AnyType:$val,
4162+
Arg<CIR_MemOrder, "memory order">:$mem_order,
4163+
UnitAttr:$is_volatile
4164+
);
4165+
4166+
let assemblyFormat = [{
4167+
$mem_order (`volatile` $is_volatile^)?
4168+
$ptr `,` $val
4169+
`:` qualified(type($ptr)) `->` type($result) attr-dict
4170+
}];
4171+
}
4172+
41344173
def CIR_AtomicCmpXchg : CIR_Op<"atomic.cmpxchg", [
41354174
AllTypesMatch<["old", "expected", "desired"]>
41364175
]> {

clang/lib/AST/ASTContext.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,9 @@ ASTContext::findPointerAuthContent(QualType T) const {
17071707
assert(isPointerAuthenticationAvailable());
17081708

17091709
T = T.getCanonicalType();
1710+
if (T->isDependentType())
1711+
return PointerAuthContent::None;
1712+
17101713
if (T.hasAddressDiscriminatedPointerAuth())
17111714
return PointerAuthContent::AddressDiscriminatedData;
17121715
const RecordDecl *RD = T->getAsRecordDecl();

clang/lib/AST/Expr.cpp

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2545,6 +2545,18 @@ Stmt *BlockExpr::getBody() {
25452545
// Generic Expression Routines
25462546
//===----------------------------------------------------------------------===//
25472547

2548+
/// Helper to determine wether \c E is a CXXConstructExpr constructing
2549+
/// a DecompositionDecl. Used to skip Clang-generated calls to std::get
2550+
/// for structured bindings.
2551+
static bool IsDecompositionDeclRefExpr(const Expr *E) {
2552+
const auto *Unwrapped = E->IgnoreUnlessSpelledInSource();
2553+
const auto *Ref = dyn_cast<DeclRefExpr>(Unwrapped);
2554+
if (!Ref)
2555+
return false;
2556+
2557+
return isa_and_nonnull<DecompositionDecl>(Ref->getDecl());
2558+
}
2559+
25482560
bool Expr::isReadIfDiscardedInCPlusPlus11() const {
25492561
// In C++11, discarded-value expressions of a certain form are special,
25502562
// according to [expr]p10:
@@ -3159,10 +3171,39 @@ Expr *Expr::IgnoreUnlessSpelledInSource() {
31593171
}
31603172
return E;
31613173
};
3174+
3175+
// Used when Clang generates calls to std::get for decomposing
3176+
// structured bindings.
3177+
auto IgnoreImplicitCallSingleStep = [](Expr *E) {
3178+
auto *C = dyn_cast<CallExpr>(E);
3179+
if (!C)
3180+
return E;
3181+
3182+
// Looking for calls to a std::get, which usually just takes
3183+
// 1 argument (i.e., the structure being decomposed). If it has
3184+
// more than 1 argument, the others need to be defaulted.
3185+
unsigned NumArgs = C->getNumArgs();
3186+
if (NumArgs == 0 || (NumArgs > 1 && !isa<CXXDefaultArgExpr>(C->getArg(1))))
3187+
return E;
3188+
3189+
Expr *A = C->getArg(0);
3190+
3191+
// This was spelled out in source. Don't ignore.
3192+
if (A->getSourceRange() != E->getSourceRange())
3193+
return E;
3194+
3195+
// If the argument refers to a DecompositionDecl construction,
3196+
// ignore it.
3197+
if (IsDecompositionDeclRefExpr(A))
3198+
return A;
3199+
3200+
return E;
3201+
};
3202+
31623203
return IgnoreExprNodes(
31633204
this, IgnoreImplicitSingleStep, IgnoreImplicitCastsExtraSingleStep,
31643205
IgnoreParensOnlySingleStep, IgnoreImplicitConstructorSingleStep,
3165-
IgnoreImplicitMemberCallSingleStep);
3206+
IgnoreImplicitMemberCallSingleStep, IgnoreImplicitCallSingleStep);
31663207
}
31673208

31683209
bool Expr::isDefaultArgument() const {

clang/lib/CIR/CodeGen/CIRGenAtomic.cpp

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ static void emitAtomicOp(CIRGenFunction &cgf, AtomicExpr *expr, Address dest,
341341
}
342342

343343
assert(!cir::MissingFeatures::atomicSyncScopeID());
344+
llvm::StringRef opName;
344345

345346
CIRGenBuilderTy &builder = cgf.getBuilder();
346347
mlir::Location loc = cgf.getLoc(expr->getSourceRange());
@@ -400,6 +401,12 @@ static void emitAtomicOp(CIRGenFunction &cgf, AtomicExpr *expr, Address dest,
400401
return;
401402
}
402403

404+
case AtomicExpr::AO__c11_atomic_exchange:
405+
case AtomicExpr::AO__atomic_exchange_n:
406+
case AtomicExpr::AO__atomic_exchange:
407+
opName = cir::AtomicXchg::getOperationName();
408+
break;
409+
403410
case AtomicExpr::AO__opencl_atomic_init:
404411

405412
case AtomicExpr::AO__hip_atomic_compare_exchange_strong:
@@ -421,11 +428,8 @@ static void emitAtomicOp(CIRGenFunction &cgf, AtomicExpr *expr, Address dest,
421428
case AtomicExpr::AO__scoped_atomic_store:
422429
case AtomicExpr::AO__scoped_atomic_store_n:
423430

424-
case AtomicExpr::AO__c11_atomic_exchange:
425431
case AtomicExpr::AO__hip_atomic_exchange:
426432
case AtomicExpr::AO__opencl_atomic_exchange:
427-
case AtomicExpr::AO__atomic_exchange_n:
428-
case AtomicExpr::AO__atomic_exchange:
429433
case AtomicExpr::AO__scoped_atomic_exchange_n:
430434
case AtomicExpr::AO__scoped_atomic_exchange:
431435

@@ -503,8 +507,23 @@ static void emitAtomicOp(CIRGenFunction &cgf, AtomicExpr *expr, Address dest,
503507

504508
case AtomicExpr::AO__atomic_clear:
505509
cgf.cgm.errorNYI(expr->getSourceRange(), "emitAtomicOp: expr op NYI");
506-
break;
510+
return;
507511
}
512+
513+
assert(!opName.empty() && "expected operation name to build");
514+
mlir::Value loadVal1 = builder.createLoad(loc, val1);
515+
516+
SmallVector<mlir::Value> atomicOperands = {ptr.getPointer(), loadVal1};
517+
SmallVector<mlir::Type> atomicResTys = {loadVal1.getType()};
518+
mlir::Operation *rmwOp = builder.create(loc, builder.getStringAttr(opName),
519+
atomicOperands, atomicResTys);
520+
521+
rmwOp->setAttr("mem_order", orderAttr);
522+
if (expr->isVolatile())
523+
rmwOp->setAttr("is_volatile", builder.getUnitAttr());
524+
525+
mlir::Value result = rmwOp->getResult(0);
526+
builder.createStore(loc, result, dest);
508527
}
509528

510529
static bool isMemOrderValid(uint64_t order, bool isStore, bool isLoad) {
@@ -572,6 +591,11 @@ RValue CIRGenFunction::emitAtomicExpr(AtomicExpr *e) {
572591
val1 = emitPointerWithAlignment(e->getVal1());
573592
break;
574593

594+
case AtomicExpr::AO__atomic_exchange:
595+
val1 = emitPointerWithAlignment(e->getVal1());
596+
dest = emitPointerWithAlignment(e->getVal2());
597+
break;
598+
575599
case AtomicExpr::AO__atomic_compare_exchange:
576600
case AtomicExpr::AO__atomic_compare_exchange_n:
577601
case AtomicExpr::AO__c11_atomic_compare_exchange_weak:
@@ -590,7 +614,9 @@ RValue CIRGenFunction::emitAtomicExpr(AtomicExpr *e) {
590614
isWeakExpr = e->getWeak();
591615
break;
592616

617+
case AtomicExpr::AO__atomic_exchange_n:
593618
case AtomicExpr::AO__atomic_store_n:
619+
case AtomicExpr::AO__c11_atomic_exchange:
594620
case AtomicExpr::AO__c11_atomic_store:
595621
val1 = emitValToTemp(*this, e->getVal1());
596622
break;

clang/lib/CIR/CodeGen/CIRGenDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ void CIRGenFunction::emitDecl(const Decl &d, bool evaluateConditionDecl) {
618618
case Decl::MSGuid: // __declspec(uuid("..."))
619619
case Decl::TemplateParamObject:
620620
case Decl::OMPThreadPrivate:
621+
case Decl::OMPGroupPrivate:
621622
case Decl::OMPAllocate:
622623
case Decl::OMPCapturedExpr:
623624
case Decl::OMPRequires:
@@ -667,7 +668,6 @@ void CIRGenFunction::emitDecl(const Decl &d, bool evaluateConditionDecl) {
667668
case Decl::UsingPack:
668669
case Decl::OMPDeclareMapper:
669670
case Decl::OMPDeclareReduction:
670-
case Decl::OMPGroupPrivate:
671671
cgm.errorNYI(d.getSourceRange(),
672672
std::string("emitDecl: unhandled decl type: ") +
673673
d.getDeclKindName());

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -878,10 +878,9 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
878878
}
879879

880880
if (ty.UseExcessPrecision(cgf.getContext())) {
881-
if (ty->getAs<VectorType>()) {
882-
assert(!cir::MissingFeatures::vectorType());
883-
cgf.cgm.errorNYI("getPromotionType: promotion to vector type");
884-
return QualType();
881+
if (auto *vt = ty->getAs<VectorType>()) {
882+
unsigned numElements = vt->getNumElements();
883+
return ctx.getVectorType(ctx.FloatTy, numElements, vt->getVectorKind());
885884
}
886885
return cgf.getContext().FloatTy;
887886
}
@@ -2356,4 +2355,4 @@ mlir::Value CIRGenFunction::emitScalarPrePostIncDec(const UnaryOperator *e,
23562355
bool isPre) {
23572356
return ScalarExprEmitter(*this, builder)
23582357
.emitScalarPrePostIncDec(e, lv, kind, isPre);
2359-
}
2358+
}

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,17 @@ mlir::LogicalResult CIRToLLVMAtomicCmpXchgLowering::matchAndRewrite(
717717
return mlir::success();
718718
}
719719

720+
mlir::LogicalResult CIRToLLVMAtomicXchgLowering::matchAndRewrite(
721+
cir::AtomicXchg op, OpAdaptor adaptor,
722+
mlir::ConversionPatternRewriter &rewriter) const {
723+
assert(!cir::MissingFeatures::atomicSyncScopeID());
724+
mlir::LLVM::AtomicOrdering llvmOrder = getLLVMMemOrder(adaptor.getMemOrder());
725+
rewriter.replaceOpWithNewOp<mlir::LLVM::AtomicRMWOp>(
726+
op, mlir::LLVM::AtomicBinOp::xchg, adaptor.getPtr(), adaptor.getVal(),
727+
llvmOrder);
728+
return mlir::success();
729+
}
730+
720731
mlir::LogicalResult CIRToLLVMBitClrsbOpLowering::matchAndRewrite(
721732
cir::BitClrsbOp op, OpAdaptor adaptor,
722733
mlir::ConversionPatternRewriter &rewriter) const {

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4051,15 +4051,24 @@ static bool RenderModulesOptions(Compilation &C, const Driver &D,
40514051
// module fragment.
40524052
CmdArgs.push_back("-fskip-odr-check-in-gmf");
40534053

4054-
if (!Args.hasArg(options::OPT_fno_modules_reduced_bmi) &&
4055-
(Input.getType() == driver::types::TY_CXXModule ||
4056-
Input.getType() == driver::types::TY_PP_CXXModule) &&
4057-
!Args.hasArg(options::OPT__precompile)) {
4058-
CmdArgs.push_back("-fmodules-reduced-bmi");
4054+
if (Input.getType() == driver::types::TY_CXXModule ||
4055+
Input.getType() == driver::types::TY_PP_CXXModule) {
4056+
if (!Args.hasArg(options::OPT_fno_modules_reduced_bmi))
4057+
CmdArgs.push_back("-fmodules-reduced-bmi");
40594058

40604059
if (Args.hasArg(options::OPT_fmodule_output_EQ))
40614060
Args.AddLastArg(CmdArgs, options::OPT_fmodule_output_EQ);
4062-
else
4061+
else if (!Args.hasArg(options::OPT__precompile) ||
4062+
Args.hasArg(options::OPT_fmodule_output))
4063+
// If --precompile is specified, we will always generate a module file if
4064+
// we're compiling an importable module unit. This is fine even if the
4065+
// compilation process won't reach the point of generating the module file
4066+
// (e.g., in the preprocessing mode), since the attached flag
4067+
// '-fmodule-output' is useless.
4068+
//
4069+
// But if '--precompile' is specified, it might be annoying to always
4070+
// generate the module file as '--precompile' will generate the module
4071+
// file anyway.
40634072
CmdArgs.push_back(Args.MakeArgString(
40644073
"-fmodule-output=" +
40654074
getCXX20NamedModuleOutputPath(Args, Input.getBaseInput())));

0 commit comments

Comments
 (0)