[clang] [CIR] Correct union lowering behavior re-padding (PR #216349)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 14 16:48:40 PDT 2026
================
@@ -532,16 +588,25 @@ mlir::Type adjustGlobalTypeForInit(mlir::Type llvmType, mlir::Attribute init,
// Structs can have a flexible array member, adjust that.
if (mlir::isa<cir::StructType>(constRecord.getType()))
return adjustGlobalStructTypeForInit(structTy, constRecord, converter,
- dataLayout);
+ dataLayout, paddingAddedIndexes);
if (mlir::isa<cir::UnionType>(constRecord.getType()))
return adjustGlobalUnionTypeForInit(structTy, constRecord, converter,
dataLayout);
return llvmType;
}
+mlir::Type adjustGlobalTypeForInit(mlir::Type llvmType, mlir::Attribute init,
+ const mlir::TypeConverter &converter,
+ const mlir::DataLayout &dataLayout) {
+ llvm::SmallVector<unsigned> ignoredAddedIndexes;
+ return adjustGlobalTypeForInit(llvmType, init, converter, dataLayout,
+ ignoredAddedIndexes);
----------------
andykaylor wrote:
Can you assert that `ignoredAddedIndexes` is empty on return here? Or is it OK for indexes to have been added on this call path?
https://github.com/llvm/llvm-project/pull/216349
More information about the cfe-commits
mailing list