[PATCH] D69761: [BPF] fix a bug in __builtin_preserve_field_info() with FIELD_BYTE_SIZE
Yonghong Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 3 07:34:23 PST 2019
yonghong-song created this revision.
yonghong-song added reviewers: ast, anakryiko.
Herald added subscribers: llvm-commits, hiraditya, aprantl.
Herald added a project: LLVM.
During deriving proper bitfield access FIELD_BYTE_SIZE,
function Member->getStorageOffsetInBits() is used to
get llvm IR type storage offset in bits so that
the byte size can permit aligned loads/stores with previously
derived FIELD_BYTE_OFFSET.
The function should only be used with bitfield members and it will
assert if ASSERT is turned on during cmake build.
Constant *getStorageOffsetInBits() const {
assert(getTag() == dwarf::DW_TAG_member && isBitField());
if (auto *C = cast_or_null<ConstantAsMetadata>(getExtraData()))
return C->getValue();
return nullptr;
}
This patch fixed the issue by using Member->isBitField()
directly and a test case is added to cover this missing case.
This issue is discovered when running Andrii's linux kernel CO-RE
tests.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D69761
Files:
llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-byte-size-4.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69761.227607.patch
Type: text/x-patch
Size: 5814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191103/4cfc35d6/attachment.bin>
More information about the llvm-commits
mailing list