[llvm] [InstCombine] Unpack scalable struct loads/stores. (PR #123986)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 22 11:52:56 PST 2025
================
@@ -722,11 +718,19 @@ static Instruction *unpackLoadToAggregate(InstCombinerImpl &IC, LoadInst &LI) {
Zero,
ConstantInt::get(IdxType, i),
};
- auto *Ptr = IC.Builder.CreateInBoundsGEP(ST, Addr, ArrayRef(Indices),
- Name + ".elt");
+ auto *Ptr = !SL->getSizeInBits().isScalable()
+ ? IC.Builder.CreateInBoundsGEP(
+ ST, Addr, ArrayRef(Indices), Name + ".elt")
+ : IC.Builder.CreateInBoundsPtrAdd(
+ Addr,
+ IC.Builder.CreateVScale(ConstantInt::get(
+ DL.getIndexType(Addr->getType()),
+ SL->getElementOffset(i).getKnownMinValue())),
----------------
nikic wrote:
Use `IRBuilder::CreateTypeSize()` and then you can use the same code for scalable and not?
https://github.com/llvm/llvm-project/pull/123986
More information about the llvm-commits
mailing list