================
@@ -179,14 +179,12 @@ convertStringAttrToDenseElementsAttr(cir::ConstArrayAttr 
attr,
 }
 
 template <> mlir::APInt getZeroInitFromType(mlir::Type ty) {
-  if (mlir::isa<cir::BoolType>(ty))
-    return mlir::APInt::getZero(1);
-  const auto intTy = mlir::cast<cir::IntType>(ty);
+  const auto intTy = mlir::cast<mlir::IntegerType>(ty);
   return mlir::APInt::getZero(intTy.getWidth());
 }
 
 template <> mlir::APFloat getZeroInitFromType(mlir::Type ty) {
-  auto fpTy = mlir::cast<cir::FPTypeInterface>(ty);
+  auto fpTy = mlir::cast<mlir::FloatType>(ty);
----------------
martin-luecke wrote:

`getZeroInitFromType` has a single in-tree call site, in 
`convertToDenseElementsAttr`. That call now passes the converted element type, 
so this specialization receives a builtin MLIR float type rather than a CIR 
type. Zero construction and dense attribute construction therefore use the same 
element type.
The conversion preserves the floating-point semantics of all current CIR FP 
types, including long double via its underlying type, so the zero values are 
unchanged. 
The existing const-array-floating-point.c 
https://github.com/llvm/llvm-project/blob/a2686fcbb1120323c607d2735a93d12f2834eb81/clang/test/CIR/CodeGen/const-array-floating-point.c#L8-L12
 checks these formats with trailing zeros and passes with this change.

https://github.com/llvm/llvm-project/pull/236082
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to