<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div></div><div><br></div><div>thanks,</div><div>Victor</div><div><br></div><div><div><div>On Sep 11, 2009, at 10:08 AM, Duncan Sands wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi Victor,<br><br><blockquote type="cite">Malloc call codegen was using ConstantExpr::getSizeOf() to determine the size of a type, when it should have been using Type-> getPrimitiveSizeInBits().<br></blockquote><br>using ConstantExpr::getSizeOf (which is the same as getTypeAllocSize)<br>was correct.  Using getPrimitiveSizeInBits is wrong, since it does not<br>take alignment into account.  Consider x86 long double, which is 80 bits<br>long (this is what getPrimitiveSizeInBits returns).  If you ask GCC what<br>sizeof(x86 long double) is, it will tell you 12 bytes or 16 bytes<br>depending on the platform.  You should be mallocing the same number of<br>bytes as sizeof gives, 12 or 16, and not 10.<br><br>Ciao,<br><br>Duncan.<br><br><br>  Fixed that.  isArrayMalloc()now<br><blockquote type="cite">correctly identifies array mallocs.<br></blockquote><blockquote type="cite">I also reorganized the InsertBefore vs. InsertAtEnd code in createMalloc() for clarity.<br></blockquote><blockquote type="cite">------------------------------------------------------------------------<br></blockquote><blockquote type="cite">Victor<br></blockquote><blockquote type="cite">------------------------------------------------------------------------<br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">llvm-commits mailing list<br></blockquote><blockquote type="cite"><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br></blockquote><blockquote type="cite"><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote><br></div></blockquote></div><br></div></body></html>