Skip to content

Commit c921ec0

Browse files
committed
Revert "[CIR][CIRGen][TBAA] Add support for scalar types (#1220)"
Fix #1246 This reverts commit c94c04e.
1 parent adae4ff commit c921ec0

File tree

20 files changed

+58
-505
lines changed

20 files changed

+58
-505
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
170170
/*alignment=*/intAttr,
171171
/*mem_order=*/
172172
cir::MemOrderAttr{},
173-
/*tbaa=*/cir::TBAAAttr{});
173+
/*tbaa=*/mlir::ArrayAttr{});
174174
}
175175

176176
mlir::Value createAlignedLoad(mlir::Location loc, mlir::Value ptr,
@@ -357,7 +357,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
357357
val.getType())
358358
dst = createPtrBitcast(dst, val.getType());
359359
return create<cir::StoreOp>(loc, val, dst, _volatile, align, order,
360-
/*tbaa=*/cir::TBAAAttr{});
360+
/*tbaa=*/mlir::ArrayAttr{});
361361
}
362362

363363
mlir::Value createAlloca(mlir::Location loc, cir::PointerType addrType,
@@ -405,7 +405,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
405405
cir::CopyOp createCopy(mlir::Value dst, mlir::Value src,
406406
bool isVolatile = false) {
407407
return create<cir::CopyOp>(dst.getLoc(), dst, src, isVolatile,
408-
/*tbaa=*/cir::TBAAAttr{});
408+
/*tbaa=*/mlir::ArrayAttr{});
409409
}
410410

411411
cir::MemCpyOp createMemCpy(mlir::Location loc, mlir::Value dst,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ include "clang/CIR/Interfaces/ASTAttrInterfaces.td"
2424
// CIR Attrs
2525
//===----------------------------------------------------------------------===//
2626

27-
class CIR_Attr<string name, string attrMnemonic, list<Trait> traits = [],
28-
string baseCppClass = "::mlir::Attribute">
29-
: AttrDef<CIR_Dialect, name, traits, baseCppClass> {
27+
class CIR_Attr<string name, string attrMnemonic, list<Trait> traits = []>
28+
: AttrDef<CIR_Dialect, name, traits> {
3029
let mnemonic = attrMnemonic;
3130
}
3231

@@ -1295,7 +1294,8 @@ def GlobalAnnotationValuesAttr : CIR_Attr<"GlobalAnnotationValues",
12951294
let genVerifyDecl = 1;
12961295
}
12971296

1298-
include "clang/CIR/Dialect/IR/CIRTBAAAttrs.td"
1297+
def CIR_TBAAAttr : CIR_Attr<"TBAA", "tbaa", []> {
1298+
}
12991299

13001300
include "clang/CIR/Dialect/IR/CIROpenCLAttrs.td"
13011301

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ def LoadOp : CIR_Op<"load", [
588588
UnitAttr:$is_volatile,
589589
OptionalAttr<I64Attr>:$alignment,
590590
OptionalAttr<MemOrder>:$mem_order,
591-
OptionalAttr<CIR_AnyTBAAAttr>:$tbaa
591+
OptionalAttr<ArrayAttr>:$tbaa
592592
);
593593
let results = (outs CIR_AnyType:$result);
594594

@@ -657,7 +657,7 @@ def StoreOp : CIR_Op<"store", [
657657
UnitAttr:$is_volatile,
658658
OptionalAttr<I64Attr>:$alignment,
659659
OptionalAttr<MemOrder>:$mem_order,
660-
OptionalAttr<CIR_AnyTBAAAttr>:$tbaa);
660+
OptionalAttr<ArrayAttr>:$tbaa);
661661

662662
let assemblyFormat = [{
663663
(`volatile` $is_volatile^)?
@@ -4068,7 +4068,7 @@ def CopyOp : CIR_Op<"copy",
40684068
let arguments = (ins Arg<CIR_PointerType, "", [MemWrite]>:$dst,
40694069
Arg<CIR_PointerType, "", [MemRead]>:$src,
40704070
UnitAttr:$is_volatile,
4071-
OptionalAttr<CIR_TBAAAttr>:$tbaa);
4071+
OptionalAttr<ArrayAttr>:$tbaa);
40724072
let summary = "Copies contents from a CIR pointer to another";
40734073
let description = [{
40744074
Given two CIR pointers, `src` and `dst`, `cir.copy` will copy the memory

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

Lines changed: 0 additions & 38 deletions
This file was deleted.

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -74,28 +74,6 @@ def CIR_IntType : CIR_Type<"Int", "int",
7474
static bool isValidPrimitiveIntBitwidth(unsigned width) {
7575
return width == 8 || width == 16 || width == 32 || width == 64;
7676
}
77-
78-
llvm::StringRef getTBAATypeName() const {
79-
switch (getWidth()) {
80-
case 1:
81-
case 8: {
82-
return "omnipotent char";
83-
}
84-
case 16: {
85-
return "short";
86-
}
87-
case 32: {
88-
return "int";
89-
}
90-
case 64: {
91-
return "long";
92-
}
93-
default: {
94-
llvm::errs() << "unknown type: " << *this << "\n";
95-
return "unknown";
96-
}
97-
}
98-
}
9977
}];
10078
let genVerifyDecl = 1;
10179
}
@@ -631,11 +609,4 @@ def CIR_AnyType : AnyTypeOf<[
631609
CIR_ComplexType
632610
]>;
633611

634-
def CIR_AnyScalarType : AnyTypeOf<[
635-
CIR_IntType, CIR_PointerType, CIR_DataMemberType, CIR_MethodType,
636-
CIR_BoolType, CIR_ArrayType, CIR_VectorType, CIR_FuncType, CIR_VoidType,
637-
CIR_ExceptionType, CIR_AnyFloat, CIR_FP16, CIR_BFloat16,
638-
CIR_ComplexType
639-
]>;
640-
641612
#endif // MLIR_CIR_DIALECT_CIR_TYPES

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,7 @@ struct MissingFeatures {
5858
// sanitizer related type check features
5959
static bool emitTypeCheck() { return false; }
6060
static bool tbaa() { return false; }
61-
static bool tbaaStruct() { return false; }
62-
static bool tbaaTagForStruct() { return false; }
63-
static bool tbaaVTablePtr() { return false; }
64-
static bool tbaaIncompleteType() { return false; }
65-
static bool tbaaMergeTBAAInfo() { return false; }
66-
static bool tbaaMayAlias() { return false; }
61+
static bool tbaa_struct() { return false; }
6762
static bool cleanups() { return false; }
6863
static bool emitNullabilityCheck() { return false; }
6964
static bool ptrAuth() { return false; }

clang/lib/CIR/CodeGen/CIRGenBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
839839
return create<cir::LoadOp>(
840840
loc, addr.getElementType(), addr.getPointer(), /*isDeref=*/false,
841841
/*is_volatile=*/isVolatile, /*alignment=*/mlir::IntegerAttr{},
842-
/*mem_order=*/cir::MemOrderAttr{}, /*tbaa=*/cir::TBAAAttr{});
842+
/*mem_order=*/cir::MemOrderAttr{}, /*tbaa=*/mlir::ArrayAttr{});
843843
}
844844

845845
mlir::Value createAlignedLoad(mlir::Location loc, mlir::Type ty,

clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ void CIRGenFunction::emitAggregateCopy(LValue Dest, LValue Src, QualType Ty,
17221722
// Determine the metadata to describe the position of any padding in this
17231723
// memcpy, as well as the TBAA tags for the members of the struct, in case
17241724
// the optimizer wishes to expand it in to scalar memory operations.
1725-
assert(!cir::MissingFeatures::tbaaStruct() && "tbaa.struct NYI");
1725+
assert(!cir::MissingFeatures::tbaa_struct() && "tbaa.struct NYI");
17261726
if (CGM.getCodeGenOpts().NewStructPathTBAA) {
17271727
TBAAAccessInfo TBAAInfo = CGM.mergeTBAAInfoForMemoryTransfer(
17281728
Dest.getTBAAInfo(), Src.getTBAAInfo());

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3995,7 +3995,7 @@ cir::TBAAAttr CIRGenModule::getTBAABaseTypeInfo(QualType QTy) {
39953995
return tbaa->getBaseTypeInfo(QTy);
39963996
}
39973997

3998-
cir::TBAAAttr CIRGenModule::getTBAAAccessTagInfo(TBAAAccessInfo tbaaInfo) {
3998+
mlir::ArrayAttr CIRGenModule::getTBAAAccessTagInfo(TBAAAccessInfo tbaaInfo) {
39993999
if (!tbaa) {
40004000
return nullptr;
40014001
}

clang/lib/CIR/CodeGen/CIRGenModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class CIRGenModule : public CIRGenTypeCache {
525525
/// type is not suitable for use in TBAA access tags.
526526
cir::TBAAAttr getTBAABaseTypeInfo(QualType QTy);
527527

528-
cir::TBAAAttr getTBAAAccessTagInfo(TBAAAccessInfo tbaaInfo);
528+
mlir::ArrayAttr getTBAAAccessTagInfo(TBAAAccessInfo tbaaInfo);
529529

530530
/// Get merged TBAA information for the purposes of type casts.
531531
TBAAAccessInfo mergeTBAAInfoForCast(TBAAAccessInfo SourceInfo,

0 commit comments

Comments
 (0)