Skip to content

Commit 4f31e52

Browse files
fmt
1 parent cdfac7f commit 4f31e52

File tree

8 files changed

+44
-31
lines changed

8 files changed

+44
-31
lines changed

clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
205205
bool isVolatile = false, uint64_t alignment = 0) {
206206
mlir::IntegerAttr alignmentAttr = getAlignmentAttr(alignment);
207207
return cir::LoadOp::create(*this, loc, ptr, /*isDeref=*/false, isVolatile,
208-
alignmentAttr, cir::MemOrderAttr{}, /*tbaa=*/mlir::ArrayAttr{});
208+
alignmentAttr, cir::MemOrderAttr{},
209+
/*tbaa=*/mlir::ArrayAttr{});
209210
}
210211

211212
mlir::Value createAlignedLoad(mlir::Location loc, mlir::Value ptr,
@@ -321,14 +322,16 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
321322
/// Create a copy with inferred length.
322323
cir::CopyOp createCopy(mlir::Value dst, mlir::Value src,
323324
bool isVolatile = false) {
324-
return cir::CopyOp::create(*this, dst.getLoc(), dst, src, isVolatile, /*tbaa=*/mlir::ArrayAttr{});
325+
return cir::CopyOp::create(*this, dst.getLoc(), dst, src, isVolatile,
326+
/*tbaa=*/mlir::ArrayAttr{});
325327
}
326328

327329
cir::StoreOp createStore(mlir::Location loc, mlir::Value val, mlir::Value dst,
328330
bool isVolatile = false,
329331
mlir::IntegerAttr align = {},
330332
cir::MemOrderAttr order = {}) {
331-
return cir::StoreOp::create(*this, loc, val, dst, isVolatile, align, order, /*tbaa=*/mlir::ArrayAttr{});
333+
return cir::StoreOp::create(*this, loc, val, dst, isVolatile, align, order,
334+
/*tbaa=*/mlir::ArrayAttr{});
332335
}
333336

334337
[[nodiscard]] cir::GlobalOp createGlobal(mlir::ModuleOp mlirModule,

clang/lib/CIR/CodeGen/CIRGenBuilder.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,8 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
462462
mlir::IntegerAttr align = getAlignmentAttr(addr.getAlignment());
463463
return cir::LoadOp::create(*this, loc, addr.getPointer(), /*isDeref=*/false,
464464
isVolatile, /*alignment=*/align,
465-
/*mem_order=*/cir::MemOrderAttr{}, /*tbaa=*/mlir::ArrayAttr{});
465+
/*mem_order=*/cir::MemOrderAttr{},
466+
/*tbaa=*/mlir::ArrayAttr{});
466467
}
467468

468469
cir::LoadOp createAlignedLoad(mlir::Location loc, mlir::Type ty,
@@ -473,7 +474,8 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
473474
mlir::IntegerAttr alignAttr = getAlignmentAttr(alignment);
474475
return cir::LoadOp::create(*this, loc, ptr, /*isDeref=*/false,
475476
/*isVolatile=*/false, alignAttr,
476-
/*mem_order=*/cir::MemOrderAttr{}, /*tbaa=*/mlir::ArrayAttr{});
477+
/*mem_order=*/cir::MemOrderAttr{},
478+
/*tbaa=*/mlir::ArrayAttr{});
477479
}
478480

479481
cir::LoadOp

clang/lib/CIR/CodeGen/CIRGenClass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ void CIRGenFunction::initializeVTablePointer(mlir::Location loc,
430430
Address vtableField = Address(vtablePtr, classAddr.getAlignment());
431431
builder.createStore(loc, vtableAddressPoint, vtableField);
432432

433-
cir::StoreOp storeOp = builder.createStore(loc, vtableAddressPoint, vtableField);
433+
cir::StoreOp storeOp =
434+
builder.createStore(loc, vtableAddressPoint, vtableField);
434435
TBAAAccessInfo tbaaInfo =
435436
cgm.getTBAAVTablePtrAccessInfo(vtableAddressPoint.getType());
436437
cgm.decorateOperationWithTBAA(storeOp, tbaaInfo);

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Address CIRGenFunction::emitAddrOfFieldStorage(Address base,
7171
/// derive a more accurate bound on the alignment of the pointer.
7272
Address CIRGenFunction::emitPointerWithAlignment(const Expr *expr,
7373
LValueBaseInfo *baseInfo,
74-
TBAAAccessInfo *tbaaInfo) {
74+
TBAAAccessInfo *tbaaInfo) {
7575
// We allow this with ObjC object pointers because of fragile ABIs.
7676
assert(expr->getType()->isPointerType() ||
7777
expr->getType()->isObjCObjectPointerType());
@@ -107,9 +107,9 @@ Address CIRGenFunction::emitPointerWithAlignment(const Expr *expr,
107107
cgm.getNaturalTypeAlignment(pointeeType, &targetTypeBaseInfo);
108108

109109
if (tbaaInfo) {
110-
TBAAAccessInfo targetTypeTbaaInfo = cgm.getTBAAAccessInfo(pointeeType);
111-
*tbaaInfo =
112-
cgm.mergeTBAAInfoForCast(*tbaaInfo, targetTypeTbaaInfo);
110+
TBAAAccessInfo targetTypeTbaaInfo =
111+
cgm.getTBAAAccessInfo(pointeeType);
112+
*tbaaInfo = cgm.mergeTBAAInfoForCast(*tbaaInfo, targetTypeTbaaInfo);
113113
}
114114

115115
// If the source l-value is opaque, honor the alignment of the
@@ -323,8 +323,8 @@ static LValue emitGlobalVarDeclLValue(CIRGenFunction &cgf, const Expr *e,
323323

324324
void CIRGenFunction::emitStoreOfScalar(mlir::Value value, Address addr,
325325
bool isVolatile, QualType ty,
326-
LValueBaseInfo baseInfo, TBAAAccessInfo tbaaInfo,
327-
bool isInit,
326+
LValueBaseInfo baseInfo,
327+
TBAAAccessInfo tbaaInfo, bool isInit,
328328
bool isNontemporal) {
329329
assert(!cir::MissingFeatures::opLoadStoreThreadLocal());
330330

@@ -365,7 +365,8 @@ void CIRGenFunction::emitStoreOfScalar(mlir::Value value, Address addr,
365365
}
366366

367367
assert(currSrcLoc && "must pass in source location");
368-
cir::StoreOp store = builder.createStore(*currSrcLoc, value, addr, isVolatile);
368+
cir::StoreOp store =
369+
builder.createStore(*currSrcLoc, value, addr, isVolatile);
369370
cgm.decorateOperationWithTBAA(store, tbaaInfo);
370371

371372
if (isNontemporal) {
@@ -501,7 +502,8 @@ LValue CIRGenFunction::emitLValueForField(LValue base, const FieldDecl *field) {
501502
// If this is a reference field, load the reference right now.
502503
if (fieldType->isReferenceType()) {
503504
assert(!cir::MissingFeatures::opTBAA());
504-
LValue refLVal = makeAddrLValue(addr, fieldType, fieldBaseInfo, fieldTbaaInfo);
505+
LValue refLVal =
506+
makeAddrLValue(addr, fieldType, fieldBaseInfo, fieldTbaaInfo);
505507
if (recordCVR & Qualifiers::Volatile)
506508
refLVal.getQuals().addVolatile();
507509
addr = emitLoadOfReference(refLVal, getLoc(field->getSourceRange()),
@@ -573,13 +575,15 @@ void CIRGenFunction::emitStoreOfScalar(mlir::Value value, LValue lvalue,
573575
}
574576

575577
emitStoreOfScalar(value, lvalue.getAddress(), lvalue.isVolatile(),
576-
lvalue.getType(), lvalue.getBaseInfo(), lvalue.getTBAAInfo(), isInit,
578+
lvalue.getType(), lvalue.getBaseInfo(),
579+
lvalue.getTBAAInfo(), isInit,
577580
/*isNontemporal=*/false);
578581
}
579582

580583
mlir::Value CIRGenFunction::emitLoadOfScalar(Address addr, bool isVolatile,
581584
QualType ty, SourceLocation loc,
582-
LValueBaseInfo baseInfo, TBAAAccessInfo tbaaInfo) {
585+
LValueBaseInfo baseInfo,
586+
TBAAAccessInfo tbaaInfo) {
583587
assert(!cir::MissingFeatures::opLoadStoreThreadLocal());
584588
mlir::Type eltTy = addr.getElementType();
585589

@@ -613,15 +617,15 @@ mlir::Value CIRGenFunction::emitLoadOfScalar(Address addr, bool isVolatile,
613617
if (!ty->isBooleanType() && ty->hasBooleanRepresentation())
614618
cgm.errorNYI("emitLoadOfScalar: boolean type with boolean representation");
615619

616-
617620
return loadOp;
618621
}
619622

620623
mlir::Value CIRGenFunction::emitLoadOfScalar(LValue lvalue,
621624
SourceLocation loc) {
622625
assert(!cir::MissingFeatures::opLoadStoreNontemporal());
623626
return emitLoadOfScalar(lvalue.getAddress(), lvalue.isVolatile(),
624-
lvalue.getType(), loc, lvalue.getBaseInfo(), lvalue.getTBAAInfo());
627+
lvalue.getType(), loc, lvalue.getBaseInfo(),
628+
lvalue.getTBAAInfo());
625629
}
626630

627631
/// Given an expression that represents a value lvalue, this
@@ -2298,7 +2302,8 @@ RValue CIRGenFunction::emitReferenceBindingToExpr(const Expr *e) {
22982302
}
22992303

23002304
Address CIRGenFunction::emitLoadOfReference(LValue refLVal, mlir::Location loc,
2301-
LValueBaseInfo *pointeeBaseInfo, TBAAAccessInfo *pointeeTbaaInfo) {
2305+
LValueBaseInfo *pointeeBaseInfo,
2306+
TBAAAccessInfo *pointeeTbaaInfo) {
23022307
if (refLVal.isVolatile())
23032308
cgm.errorNYI(loc, "load of volatile reference");
23042309

@@ -2322,7 +2327,8 @@ LValue CIRGenFunction::emitLoadOfReferenceLValue(Address refAddr,
23222327
LValue refLVal = makeAddrLValue(refAddr, refTy, LValueBaseInfo(source));
23232328
LValueBaseInfo pointeeBaseInfo;
23242329
TBAAAccessInfo tbaaAccessInfo;
2325-
Address pointeeAddr = emitLoadOfReference(refLVal, loc, &pointeeBaseInfo, &tbaaAccessInfo);
2330+
Address pointeeAddr =
2331+
emitLoadOfReference(refLVal, loc, &pointeeBaseInfo, &tbaaAccessInfo);
23262332
return makeAddrLValue(pointeeAddr, refLVal.getType()->getPointeeType(),
23272333
pointeeBaseInfo, tbaaAccessInfo);
23282334
}

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,8 @@ class CIRGenFunction : public CIRGenTypeCache {
16731673
RValue emitLoadOfLValue(LValue lv, SourceLocation loc);
16741674

16751675
Address emitLoadOfReference(LValue refLVal, mlir::Location loc,
1676-
LValueBaseInfo *pointeeBaseInfo, TBAAAccessInfo *pointeeTbaaInfo);
1676+
LValueBaseInfo *pointeeBaseInfo,
1677+
TBAAAccessInfo *pointeeTbaaInfo);
16771678
LValue emitLoadOfReferenceLValue(Address refAddr, mlir::Location loc,
16781679
QualType refTy, AlignmentSource source);
16791680

@@ -1683,7 +1684,8 @@ class CIRGenFunction : public CIRGenTypeCache {
16831684
/// l-value.
16841685
mlir::Value emitLoadOfScalar(LValue lvalue, SourceLocation loc);
16851686
mlir::Value emitLoadOfScalar(Address addr, bool isVolatile, QualType ty,
1686-
SourceLocation loc, LValueBaseInfo baseInfo, TBAAAccessInfo tbaaInfo);
1687+
SourceLocation loc, LValueBaseInfo baseInfo,
1688+
TBAAAccessInfo tbaaInfo);
16871689

16881690
/// Emit code to compute a designator that specifies the location
16891691
/// of the expression.
@@ -1723,7 +1725,7 @@ class CIRGenFunction : public CIRGenTypeCache {
17231725
/// explicit source.
17241726
Address emitPointerWithAlignment(const clang::Expr *expr,
17251727
LValueBaseInfo *baseInfo = nullptr,
1726-
TBAAAccessInfo *tbaaInfo = nullptr);
1728+
TBAAAccessInfo *tbaaInfo = nullptr);
17271729

17281730
/// Emits a reference binding to the passed in expression.
17291731
RValue emitReferenceBindingToExpr(const Expr *e);
@@ -1752,8 +1754,9 @@ class CIRGenFunction : public CIRGenTypeCache {
17521754
bool isInit);
17531755

17541756
void emitStoreOfScalar(mlir::Value value, Address addr, bool isVolatile,
1755-
clang::QualType ty, LValueBaseInfo baseInfo, TBAAAccessInfo tbaaInfo,
1756-
bool isInit = false, bool isNontemporal = false);
1757+
clang::QualType ty, LValueBaseInfo baseInfo,
1758+
TBAAAccessInfo tbaaInfo, bool isInit = false,
1759+
bool isNontemporal = false);
17571760
void emitStoreOfScalar(mlir::Value value, LValue lvalue, bool isInit);
17581761

17591762
/// Store the specified rvalue into the specified

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,11 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext,
9999
astContext.getTargetInfo().getPointerAlign(LangAS::Default))
100100
.getQuantity();
101101

102-
103102
// Enable TBAA unless it's suppressed. TSan and TySan need TBAA even at O0.
104103
if (langOpts.Sanitize.hasOneOf(SanitizerKind::Thread | SanitizerKind::Type) ||
105104
(!codeGenOpts.RelaxedAliasing && codeGenOpts.OptimizationLevel > 0))
106-
tbaa = std::make_unique<CIRGenTBAA>(&mlirContext, astContext, getTypes(), theModule, codeGenOpts,
107-
getLangOpts());
105+
tbaa = std::make_unique<CIRGenTBAA>(&mlirContext, astContext, getTypes(),
106+
theModule, codeGenOpts, getLangOpts());
108107

109108
const unsigned charSize = astContext.getTargetInfo().getCharWidth();
110109
uCharTy = cir::IntType::get(&getMLIRContext(), charSize, /*isSigned=*/false);
@@ -2570,4 +2569,3 @@ CIRGenModule::mergeTBAAInfoForMemoryTransfer(TBAAAccessInfo destInfo,
25702569
return TBAAAccessInfo();
25712570
return tbaa->mergeTBAAInfoForConditionalOperator(destInfo, srcInfo);
25722571
}
2573-

clang/lib/CIR/CodeGen/CIRGenTBAA.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,4 @@ CIRGenTBAA::mergeTBAAInfoForMemoryTransfer(TBAAAccessInfo destInfo,
6161
return TBAAAccessInfo();
6262
}
6363

64-
6564
} // namespace clang::CIRGen

clang/lib/CIR/Dialect/IR/CIRMemorySlot.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ DeletionKind cir::CopyOp::removeBlockingUses(
143143
cir::StoreOp::create(builder, getLoc(), reachingDefinition, getDst(),
144144
/*isVolatile=*/false,
145145
/*alignment=*/mlir::IntegerAttr{},
146-
/*mem-order=*/cir::MemOrderAttr(), /*tbaa=*/mlir::ArrayAttr{});
146+
/*mem-order=*/cir::MemOrderAttr(),
147+
/*tbaa=*/mlir::ArrayAttr{});
147148
return DeletionKind::Delete;
148149
}
149150

0 commit comments

Comments
 (0)