[llvm] [SROA] Preserve inherited alignment when rewriting allocas (PR #222967)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 16:59:03 PDT 2026
================
@@ -5581,11 +5581,20 @@ SROA::rewritePartition(AllocaInst &AI, AllocaSlices &AS, Partition &P) {
// If we will get at least this much alignment from the type alone, leave
// the alloca's alignment unconstrained.
const bool IsUnconstrained = Alignment <= DL.getABITypeAlign(PartitionTy);
- NewAI = new AllocaInst(
- PartitionTy, AI.getAddressSpace(), nullptr,
- IsUnconstrained ? DL.getPrefTypeAlign(PartitionTy) : Alignment,
- AI.getName() + ".sroa." + Twine(P.begin() - AS.begin()),
- AI.getIterator());
+ Align NewAlignment = Alignment;
+ if (IsUnconstrained) {
----------------
zhouguangyuan0718 wrote:
thanks for review, i updated the patch as your comment. it's clear than before.
https://github.com/llvm/llvm-project/pull/222967
More information about the llvm-commits
mailing list