Skip to content

Commit e12ff33

Browse files
authored
[CIR] Standardize element type name between Array and Vector Types (#137465)
Standardize the element type name
1 parent 59978b2 commit e12ff33

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,18 +292,18 @@ def CIR_ArrayType : CIR_Type<"Array", "array",
292292
`CIR.array` represents C/C++ constant arrays.
293293
}];
294294

295-
let parameters = (ins "mlir::Type":$eltType, "uint64_t":$size);
295+
let parameters = (ins "mlir::Type":$elementType, "uint64_t":$size);
296296

297297
let builders = [
298298
TypeBuilderWithInferredContext<(ins
299-
"mlir::Type":$eltType, "uint64_t":$size
299+
"mlir::Type":$elementType, "uint64_t":$size
300300
), [{
301-
return $_get(eltType.getContext(), eltType, size);
301+
return $_get(elementType.getContext(), elementType, size);
302302
}]>,
303303
];
304304

305305
let assemblyFormat = [{
306-
`<` $eltType `x` $size `>`
306+
`<` $elementType `x` $size `>`
307307
}];
308308
}
309309

clang/lib/CIR/CodeGen/CIRGenBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mlir::Value CIRGenBuilderTy::maybeBuildArrayDecay(mlir::Location loc,
1717
const auto arrayTy = mlir::dyn_cast<cir::ArrayType>(arrayPtrTy.getPointee());
1818

1919
if (arrayTy) {
20-
const cir::PointerType flatPtrTy = getPointerTo(arrayTy.getEltType());
20+
const cir::PointerType flatPtrTy = getPointerTo(arrayTy.getElementType());
2121
return create<cir::CastOp>(loc, flatPtrTy, cir::CastKind::array_to_ptrdecay,
2222
arrayPtr);
2323
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ ConstArrayAttr::verify(function_ref<::mlir::InFlightDiagnostic()> emitError,
203203

204204
if (auto strAttr = mlir::dyn_cast<StringAttr>(elts)) {
205205
const auto arrayTy = mlir::cast<ArrayType>(type);
206-
const auto intTy = mlir::dyn_cast<IntType>(arrayTy.getEltType());
206+
const auto intTy = mlir::dyn_cast<IntType>(arrayTy.getElementType());
207207

208208
// TODO: add CIR type for char.
209209
if (!intTy || intTy.getWidth() != 8) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,13 +658,13 @@ BoolType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
658658
llvm::TypeSize
659659
ArrayType::getTypeSizeInBits(const ::mlir::DataLayout &dataLayout,
660660
::mlir::DataLayoutEntryListRef params) const {
661-
return getSize() * dataLayout.getTypeSizeInBits(getEltType());
661+
return getSize() * dataLayout.getTypeSizeInBits(getElementType());
662662
}
663663

664664
uint64_t
665665
ArrayType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
666666
::mlir::DataLayoutEntryListRef params) const {
667-
return dataLayout.getTypeABIAlignment(getEltType());
667+
return dataLayout.getTypeABIAlignment(getElementType());
668668
}
669669

670670
//===----------------------------------------------------------------------===//

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter &converter,
13901390
});
13911391
converter.addConversion([&](cir::ArrayType type) -> mlir::Type {
13921392
mlir::Type ty =
1393-
convertTypeForMemory(converter, dataLayout, type.getEltType());
1393+
convertTypeForMemory(converter, dataLayout, type.getElementType());
13941394
return mlir::LLVM::LLVMArrayType::get(ty, type.getSize());
13951395
});
13961396
converter.addConversion([&](cir::VectorType type) -> mlir::Type {

clang/lib/CIR/Lowering/LoweringHelpers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void convertToDenseElementsAttrImpl(
6363
if (auto stringAttr = mlir::dyn_cast<mlir::StringAttr>(attr.getElts())) {
6464
if (auto arrayType = mlir::dyn_cast<cir::ArrayType>(attr.getType())) {
6565
for (auto element : stringAttr) {
66-
auto intAttr = cir::IntAttr::get(arrayType.getEltType(), element);
66+
auto intAttr = cir::IntAttr::get(arrayType.getElementType(), element);
6767
values[currentIndex++] = mlir::dyn_cast<AttrTy>(intAttr).getValue();
6868
}
6969
return;
@@ -128,7 +128,7 @@ lowerConstArrayAttr(cir::ConstArrayAttr constArr,
128128
auto dims = llvm::SmallVector<int64_t, 2>{};
129129
while (auto arrayType = mlir::dyn_cast<cir::ArrayType>(type)) {
130130
dims.push_back(arrayType.getSize());
131-
type = arrayType.getEltType();
131+
type = arrayType.getElementType();
132132
}
133133

134134
if (mlir::isa<mlir::StringAttr>(constArr.getElts()))

0 commit comments

Comments
 (0)