manmanren added a comment.


> If Capacity is not a multiple of 8, (LocalSize + NumBytesAtAlign4) % 8 
> doesn't tell you whether the new element will be 8-byte aligned. For example, 
> if Capacity==36, NumBytesAtAlign4==4, and LocalSize==8, (LocalSize + 
> NumBytesAtAlign4) equals 12 but padding is not needed as the new element can 
> start at Index=24.


I was reading the numbers wrong.

> Note that it's possible to have a Capacity that isn't a multiple of 8 by 
> calling TypeLocBuilder::reserve. I think padding is needed if the new index 
> (Index - LocalSize) is not a multiple of 8.


You are right, I missed the case where Capacity may not be 8-byte aligned.


http://reviews.llvm.org/D16843



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to