On Fri, Mar 2, 2012 at 1:13 PM, Chris Lattner <[email protected]> wrote: > > On Mar 2, 2012, at 12:09 PM, Eli Friedman wrote: > >> On Fri, Mar 2, 2012 at 3:57 AM, Jay Foad <[email protected]> wrote: >>> http://llvm.org/bugs/show_bug.cgi?id=12094 >>> >>> The attached patch: >>> >>> - Makes CGBuiltin.cpp's helper function GetPointeeAlignment into a >>> proper member of CodeGenFunction and splits it into two: >>> -- GetPointeeAlignment, which returns alignment as an unsigned, and >>> -- GetPointeeAlignmentValue, which wraps the result in an llvm::Value >>> for the convenience of generating ARM NEON intrinsics. >>> >>> - Uses GetPointeeAlignment to set a sensible alignment on all memory >>> intrinsics (memcpy, memset etc.) instead of the conservative default >>> of 1. >> >> I don't think this is really safe; strictly speaking, yes, an int* is >> required to be appropriately aligned, but in practice neither clang >> nor gcc has ever tried to enforce that, so making that assumption is >> going to cause trouble. > > Hi Eli, > > Is this a vague concern or a specific one? Even GCC-4.2 has been doing this > optimization. I consider this "fixing a regression compared to GCC", not an > innovation in optimization.
I can't point to a specific example off the top of my head, but I do know that we've suggested switching code that uses unaligned loads to use memcpy without specifically noting that the type of the pointer matters. -Eli _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
