<div dir="ltr">Yeah, doesn't look like this code handles a value crossing the boundary of the size of the bitfield type (it's reading only the low bit).<br><br>I suspect looking at the code that generates bitfield accesses would be useful - and/or maybe actually calling into that very code, rather than reimplementing it here? CodeGenFunction::EmitLoadOfBitfieldLValue seems to be the place to go (I found this by writing a short example that loads one of these strided bitfield values & then breaking in llvm::BinaryOperator::BinaryOperator until I found the 'and' operation, since that seemed like the more interesting one).<br><br><br></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jun 29, 2018 at 9:47 AM Paul Semel via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">paulsemel added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D47953#1143044" rel="noreferrer" target="_blank">https://reviews.llvm.org/D47953#1143044</a>, @dblaikie wrote:<br>
<br>
> This doesn't seem to build for me - so hard to debug/probe it:<br>
><br>
> llvm/src/tools/clang/lib/CodeGen/CGBuiltin.cpp:1264:65: error: no viable conversion from 'clang::QualType' to 'llvm::Type *'<br>
><br>
>   CGF.CGM.getDataLayout().getTypeSizeInBits(CanonicalType),<br>
>                                             ^~~~~~~~~~~~~<br>
><br>
> llvm/src/include/llvm/IR/DataLayout.h:560:53: note: passing argument to parameter 'Ty' here<br>
>  inline uint64_t DataLayout::getTypeSizeInBits(Type *Ty) const {<br>
><br>
>   ^<br>
><br>
> 1 error generated.<br>
<br>
<br>
Very sorry about it, I should have paid more attention..<br>
<br>
<br>
Repository:<br>
  rC Clang<br>
<br>
<a href="https://reviews.llvm.org/D47953" rel="noreferrer" target="_blank">https://reviews.llvm.org/D47953</a><br>
<br>
<br>
<br>
</blockquote></div>