[clang] ad94af9 - [CIR] React to breaking change to DataLayoutTypeInterface (#128772)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 25 13:44:28 PST 2025
Author: David Olsen
Date: 2025-02-25T13:44:24-08:00
New Revision: ad94af973a76ecaa3e6a85304a4abe8130e88bdb
URL: https://github.com/llvm/llvm-project/commit/ad94af973a76ecaa3e6a85304a4abe8130e88bdb
DIFF: https://github.com/llvm/llvm-project/commit/ad94af973a76ecaa3e6a85304a4abe8130e88bdb.diff
LOG: [CIR] React to breaking change to DataLayoutTypeInterface (#128772)
In #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.
Added:
Modified:
clang/lib/CIR/Dialect/IR/CIRTypes.cpp
Removed:
################################################################################
diff --git a/clang/lib/CIR/Dialect/IR/CIRTypes.cpp b/clang/lib/CIR/Dialect/IR/CIRTypes.cpp
index f3349250f2205..d1b143efb955e 100644
--- a/clang/lib/CIR/Dialect/IR/CIRTypes.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRTypes.cpp
@@ -125,12 +125,6 @@ uint64_t IntType::getABIAlignment(const mlir::DataLayout &dataLayout,
return (uint64_t)(getWidth() / 8);
}
-uint64_t
-IntType::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
- ::mlir::DataLayoutEntryListRef params) const {
- return (uint64_t)(getWidth() / 8);
-}
-
mlir::LogicalResult
IntType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
unsigned width, bool isSigned) {
@@ -163,12 +157,6 @@ SingleType::getABIAlignment(const mlir::DataLayout &dataLayout,
return (uint64_t)(getWidth() / 8);
}
-uint64_t
-SingleType::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
- ::mlir::DataLayoutEntryListRef params) const {
- return (uint64_t)(getWidth() / 8);
-}
-
const llvm::fltSemantics &DoubleType::getFloatSemantics() const {
return llvm::APFloat::IEEEdouble();
}
@@ -185,12 +173,6 @@ DoubleType::getABIAlignment(const mlir::DataLayout &dataLayout,
return (uint64_t)(getWidth() / 8);
}
-uint64_t
-DoubleType::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
- ::mlir::DataLayoutEntryListRef params) const {
- return (uint64_t)(getWidth() / 8);
-}
-
const llvm::fltSemantics &FP16Type::getFloatSemantics() const {
return llvm::APFloat::IEEEhalf();
}
@@ -206,12 +188,6 @@ uint64_t FP16Type::getABIAlignment(const mlir::DataLayout &dataLayout,
return (uint64_t)(getWidth() / 8);
}
-uint64_t
-FP16Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
- ::mlir::DataLayoutEntryListRef params) const {
- return (uint64_t)(getWidth() / 8);
-}
-
const llvm::fltSemantics &BF16Type::getFloatSemantics() const {
return llvm::APFloat::BFloat();
}
@@ -227,12 +203,6 @@ uint64_t BF16Type::getABIAlignment(const mlir::DataLayout &dataLayout,
return (uint64_t)(getWidth() / 8);
}
-uint64_t
-BF16Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
- ::mlir::DataLayoutEntryListRef params) const {
- return (uint64_t)(getWidth() / 8);
-}
-
const llvm::fltSemantics &FP80Type::getFloatSemantics() const {
return llvm::APFloat::x87DoubleExtended();
}
@@ -249,12 +219,6 @@ uint64_t FP80Type::getABIAlignment(const mlir::DataLayout &dataLayout,
return 16;
}
-uint64_t
-FP80Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
- ::mlir::DataLayoutEntryListRef params) const {
- return 16;
-}
-
const llvm::fltSemantics &FP128Type::getFloatSemantics() const {
return llvm::APFloat::IEEEquad();
}
@@ -270,12 +234,6 @@ uint64_t FP128Type::getABIAlignment(const mlir::DataLayout &dataLayout,
return 16;
}
-uint64_t
-FP128Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
- ::mlir::DataLayoutEntryListRef params) const {
- return 16;
-}
-
const llvm::fltSemantics &LongDoubleType::getFloatSemantics() const {
return mlir::cast<cir::CIRFPTypeInterface>(getUnderlying())
.getFloatSemantics();
@@ -295,13 +253,6 @@ LongDoubleType::getABIAlignment(const mlir::DataLayout &dataLayout,
.getABIAlignment(dataLayout, params);
}
-uint64_t LongDoubleType::getPreferredAlignment(
- const ::mlir::DataLayout &dataLayout,
- mlir::DataLayoutEntryListRef params) const {
- return mlir::cast<mlir::DataLayoutTypeInterface>(getUnderlying())
- .getPreferredAlignment(dataLayout, params);
-}
-
LogicalResult
LongDoubleType::verify(function_ref<InFlightDiagnostic()> emitError,
mlir::Type underlying) {
@@ -397,12 +348,6 @@ BoolType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
return 1;
}
-uint64_t
-BoolType::getPreferredAlignment(const ::mlir::DataLayout &dataLayout,
- ::mlir::DataLayoutEntryListRef params) const {
- return 1;
-}
-
//===----------------------------------------------------------------------===//
// PointerType Definitions
//===----------------------------------------------------------------------===//
@@ -421,13 +366,6 @@ PointerType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
return 8;
}
-uint64_t PointerType::getPreferredAlignment(
- const ::mlir::DataLayout &dataLayout,
- ::mlir::DataLayoutEntryListRef params) const {
- // FIXME: improve this in face of address spaces
- return 8;
-}
-
mlir::LogicalResult
PointerType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
mlir::Type pointee) {
More information about the cfe-commits
mailing list