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

Yonghong Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 17 10:26:26 PDT 2021


yonghong-song added a comment.

I just tested the patch with kernel bpf selftests and it works fine. The patch looks good to me too.



================
Comment at: llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp:303
     CInfo.RecordAlignment =
         DL->getABITypeAlign(CInfo.Base->getType()->getPointerElementType());
     return true;
----------------
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.


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

https://reviews.llvm.org/D106184



More information about the cfe-commits mailing list