================ @@ -1163,6 +1163,27 @@ emitArrayConstant(CIRGenModule &cgm, mlir::Type desiredType, const unsigned trailingZeroes = arrayBound - nonzeroLength; + // If we have a significant block of trailing zeros and a common scalar + // (integer or floating-point) element type, prefer a single ConstArrayAttr + // of the desired array type with a `trailingZerosNum` hint instead of + // synthesizing a packed anonymous record around a `[N x t] zeroinitializer` + // tail. This keeps the array's type in agreement with what the enclosing + // record layout expects. The element-type guard must stay in sync with the + // CIR-to-LLVM split predicate (shouldSplitTrailingZeros): pointer/bool arrays + // are not split there, so emitting the hint for them would just materialize + // the whole tail. Those keep the anonymous-record path below. + if (trailingZeroes >= 8 && commonElementType && ---------------- erichkeane wrote:
Don't change this/make this change at all. We should be able to fix this independently (and I'd asked to do this only at the CIR level). See https://github.com/llvm/llvm-project/pull/206137 which removes all of this anyway. https://github.com/llvm/llvm-project/pull/205918 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
