Skip to content

Commit ad94af9

Browse files
authored
[CIR] React to breaking change to DataLayoutTypeInterface (llvm#128772)
In llvm#128754, `DataLayoutTypeInterface` was changed to give `getPreferredAlignment` a default implemention. As a result, table-gen no longer declared `getPreferredAlignment` when defining a class that contained `[DeclareTypeInterfaceMethods<DataLayoutTypeInterface>]` in the table-gen definition. That means all of the definitions in `CIRTypes.cpp`, such as `PointerType::getPreferredAligment`, were compilation errors. Delete all the definitions of `getPreferredAlignment`. I verified that the default implementation does the exact same thing as the explicit overrides that are being deleted.
1 parent 2646c36 commit ad94af9

File tree

1 file changed

+0
-62
lines changed

1 file changed

+0
-62
lines changed

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

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@ uint64_t IntType::getABIAlignment(const mlir::DataLayout &dataLayout,
125125
return (uint64_t)(getWidth() / 8);
126126
}
127127

128-
uint64_t
129-
IntType::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
130-
::mlir::DataLayoutEntryListRef params) const {
131-
return (uint64_t)(getWidth() / 8);
132-
}
133-
134128
mlir::LogicalResult
135129
IntType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
136130
unsigned width, bool isSigned) {
@@ -163,12 +157,6 @@ SingleType::getABIAlignment(const mlir::DataLayout &dataLayout,
163157
return (uint64_t)(getWidth() / 8);
164158
}
165159

166-
uint64_t
167-
SingleType::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
168-
::mlir::DataLayoutEntryListRef params) const {
169-
return (uint64_t)(getWidth() / 8);
170-
}
171-
172160
const llvm::fltSemantics &DoubleType::getFloatSemantics() const {
173161
return llvm::APFloat::IEEEdouble();
174162
}
@@ -185,12 +173,6 @@ DoubleType::getABIAlignment(const mlir::DataLayout &dataLayout,
185173
return (uint64_t)(getWidth() / 8);
186174
}
187175

188-
uint64_t
189-
DoubleType::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
190-
::mlir::DataLayoutEntryListRef params) const {
191-
return (uint64_t)(getWidth() / 8);
192-
}
193-
194176
const llvm::fltSemantics &FP16Type::getFloatSemantics() const {
195177
return llvm::APFloat::IEEEhalf();
196178
}
@@ -206,12 +188,6 @@ uint64_t FP16Type::getABIAlignment(const mlir::DataLayout &dataLayout,
206188
return (uint64_t)(getWidth() / 8);
207189
}
208190

209-
uint64_t
210-
FP16Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
211-
::mlir::DataLayoutEntryListRef params) const {
212-
return (uint64_t)(getWidth() / 8);
213-
}
214-
215191
const llvm::fltSemantics &BF16Type::getFloatSemantics() const {
216192
return llvm::APFloat::BFloat();
217193
}
@@ -227,12 +203,6 @@ uint64_t BF16Type::getABIAlignment(const mlir::DataLayout &dataLayout,
227203
return (uint64_t)(getWidth() / 8);
228204
}
229205

230-
uint64_t
231-
BF16Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
232-
::mlir::DataLayoutEntryListRef params) const {
233-
return (uint64_t)(getWidth() / 8);
234-
}
235-
236206
const llvm::fltSemantics &FP80Type::getFloatSemantics() const {
237207
return llvm::APFloat::x87DoubleExtended();
238208
}
@@ -249,12 +219,6 @@ uint64_t FP80Type::getABIAlignment(const mlir::DataLayout &dataLayout,
249219
return 16;
250220
}
251221

252-
uint64_t
253-
FP80Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
254-
::mlir::DataLayoutEntryListRef params) const {
255-
return 16;
256-
}
257-
258222
const llvm::fltSemantics &FP128Type::getFloatSemantics() const {
259223
return llvm::APFloat::IEEEquad();
260224
}
@@ -270,12 +234,6 @@ uint64_t FP128Type::getABIAlignment(const mlir::DataLayout &dataLayout,
270234
return 16;
271235
}
272236

273-
uint64_t
274-
FP128Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
275-
::mlir::DataLayoutEntryListRef params) const {
276-
return 16;
277-
}
278-
279237
const llvm::fltSemantics &LongDoubleType::getFloatSemantics() const {
280238
return mlir::cast<cir::CIRFPTypeInterface>(getUnderlying())
281239
.getFloatSemantics();
@@ -295,13 +253,6 @@ LongDoubleType::getABIAlignment(const mlir::DataLayout &dataLayout,
295253
.getABIAlignment(dataLayout, params);
296254
}
297255

298-
uint64_t LongDoubleType::getPreferredAlignment(
299-
const ::mlir::DataLayout &dataLayout,
300-
mlir::DataLayoutEntryListRef params) const {
301-
return mlir::cast<mlir::DataLayoutTypeInterface>(getUnderlying())
302-
.getPreferredAlignment(dataLayout, params);
303-
}
304-
305256
LogicalResult
306257
LongDoubleType::verify(function_ref<InFlightDiagnostic()> emitError,
307258
mlir::Type underlying) {
@@ -397,12 +348,6 @@ BoolType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
397348
return 1;
398349
}
399350

400-
uint64_t
401-
BoolType::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
402-
::mlir::DataLayoutEntryListRef params) const {
403-
return 1;
404-
}
405-
406351
//===----------------------------------------------------------------------===//
407352
// PointerType Definitions
408353
//===----------------------------------------------------------------------===//
@@ -421,13 +366,6 @@ PointerType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
421366
return 8;
422367
}
423368

424-
uint64_t PointerType::getPreferredAlignment(
425-
const ::mlir::DataLayout &dataLayout,
426-
::mlir::DataLayoutEntryListRef params) const {
427-
// FIXME: improve this in face of address spaces
428-
return 8;
429-
}
430-
431369
mlir::LogicalResult
432370
PointerType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
433371
mlir::Type pointee) {

0 commit comments

Comments
 (0)