[PATCH] D36562: [Bitfield] Make the bitfield a separate location if it has width of legal integer type and its bit offset is naturally aligned for the type
Wei Mi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 5 18:22:37 PDT 2017
wmi marked an inline comment as done.
wmi added inline comments.
================
Comment at: lib/CodeGen/CGRecordLayoutBuilder.cpp:444
// Add bitfields to the run as long as they qualify.
- if (Field != FieldEnd && Field->getBitWidthValue(Context) != 0 &&
- Tail == getFieldBitOffset(*Field)) {
- Tail += Field->getBitWidthValue(Context);
- ++Field;
- continue;
+ if (Field != FieldEnd && !SingleFieldRun) {
+ SingleFieldRun = betterBeSingleFieldRun(Field);
----------------
hfinkel wrote:
> The logic here is not obvious. Can you please add a comment. SingleFieldRun here is only not equal to `betterBeSingleFieldRun(Field)` if we've skipped 0-length bitfields, right? Please explain what's going on and also please make sure there's a test case.
I restructure the code a little bit and hope the logic is more clear. I already have a testcase added for it.
Repository:
rL LLVM
https://reviews.llvm.org/D36562
More information about the llvm-commits
mailing list