Author: majnemer Date: Mon Feb 24 19:20:15 2014 New Revision: 202098 URL: http://llvm.org/viewvc/llvm-project?rev=202098&view=rev Log: IRGen: Simplify alignment calculation in setBitFieldInfo
Take advantage of CharUnits::alignmentAtOffset instead of calculating it by hand. Differential Revision: http://llvm-reviews.chandlerc.com/D2862 Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=202098&r1=202097&r2=202098&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original) +++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Mon Feb 24 19:20:15 2014 @@ -220,10 +220,8 @@ void CGRecordLowering::setBitFieldInfo( // Here we calculate the actual storage alignment of the bits. E.g if we've // got an alignment >= 2 and the bitfield starts at offset 6 we've got an // alignment of 2. - Info.StorageAlignment = (unsigned)( - StartOffset % Layout.getAlignment() ? - 1ll << llvm::countTrailingZeros((uint64_t)StartOffset.getQuantity()) : - Layout.getAlignment().getQuantity()); + Info.StorageAlignment = + Layout.getAlignment().alignmentAtOffset(StartOffset).getQuantity(); if (Info.Size > Info.StorageSize) Info.Size = Info.StorageSize; // Reverse the bit offsets for big endian machines. Because we represent _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
