llvm-project
abc165cb - [NFCI][IR] Thread `DataLayout` through aggregate construction for collapse checks

Commit
1 day ago
[NFCI][IR] Thread `DataLayout` through aggregate construction for collapse checks Add `const DataLayout *DL = nullptr` to `ConstantArray::get`, `ConstantStruct::get`, `ConstantVector::get`, and `ConstantVector::getSplat` so the collapse-to-`ConstantAggregateZero` check uses `isZeroValue(DL)` instead of `isZeroValue()`. This is preparatory work for the upcoming `ConstantPointerNull` semantic change, where `getZeroValue(ptrTy)` will diverge from `ConstantPointerNull`. Without DL-aware collapse, aggregates containing CPN would stop collapsing to CAZ, causing widespread test churn. With this change, callers that pass DL will see correct collapse behavior, while callers without DL fall back to a conservative identity check.
Author
Committer
Parents
Loading