[llvm-dev] How exactly is datatype alignment determined?

Dr. ERDI Gergo via llvm-dev llvm-dev at lists.llvm.org
Wed May 24 06:08:44 PDT 2017


On Mon, 22 May 2017, Craig Topper wrote:

> The 8 in the data layout string should have been converted to a byte value by this
> code before it was passed to setAlignment. As far as I cant ell getAlignment should
> return the byte alignment that was passed to setAlignment, not the bit alignment from
> the string.      // ABI alignment.

Thanks, yes, I can see that the '8' is converted to the byte alignment 
value '1', which is correct.
Now I've added lots of debug printing to IR/DataLayout.cpp, and it seems 
that 'a:8' or 'a:8:8' is correctly processed from the IR file to set 
aggregate alignment to the value '1'. However, I see that there's also 
someone else calling setAlignment, *after* the .ll file's datalayout 
specification is applied. And that someone else is explicitly setting the 
Aggregate layout to be 8-byte aligned :O

So now I guess I'll have to track down who else is overriding the 
alignment settings.


More information about the llvm-dev mailing list