[PATCH] D106184: [BPF] Use elementtype attribute for preserve.array/struct.index intrinsics

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 08:14:43 PST 2022


nikic added inline comments.
Herald added a project: All.


================
Comment at: llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp:303
     CInfo.RecordAlignment =
         DL->getABITypeAlign(CInfo.Base->getType()->getPointerElementType());
     return true;
----------------
yonghong-song wrote:
> nikic wrote:
> > I noticed too late that this intrinsic also uses the element type to get the alignment. I'll have to follow up with the same change for this intrinsic.
> > 
> > Though I'm not completely sure if this is actually used, because no tests fail if I replace this with dummy values like 1 or 128.
> This is for llvm.preserve.union.access.index. It is used only if the union member type is a bitfield and we don't have any usecase and test case for that. That is why we didn't hit it.
> 
> It is okay for now. I probably will change to use getBaseElementType(Call) later by myself.
I want to check back here on what we should do with this intrinsic. Should it be changed to use `elementtype` as well?

A possible alternative is to only add an `align` attribute to it, as it's the only part being actually used.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106184/new/

https://reviews.llvm.org/D106184



More information about the llvm-commits mailing list