From: Warren Hunt Date: Wed, 30 Oct 2013 00:14:55 +0000 (+0000) Subject: Minor efficiency refactor related to 193661. No functional change. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58656de61dd044410ad2e9f36b20dfd988400120;p=clang Minor efficiency refactor related to 193661. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193665 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp index e67f517e1e..a4e938fcca 100644 --- a/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -201,11 +201,9 @@ public: } void CGRecordLayoutBuilder::Layout(const RecordDecl *D) { - Alignment = Types.getContext().getASTRecordLayout(D).getAlignment(); - Packed = D->hasAttr(); const ASTRecordLayout &Layout = Types.getContext().getASTRecordLayout(D); - if (Layout.getSize() % Layout.getAlignment() != 0) - Packed = true; + Alignment = Layout.getAlignment(); + Packed = D->hasAttr() || Layout.getSize() % Alignment != 0; if (D->isUnion()) { LayoutUnion(D);