[CodeGen] Fix access sizes in new-format TBAA tags

The new format requires to specify both the type of the access
and its size. This patch fixes setting access sizes for TBAA tags
that denote accesses to structure members. This fix affects all
future TBAA metadata tests for the new format, so I guess we
don't need any special tests for this fix.

Differential Revision: https://reviews.llvm.org/D41452

llvm-svn: 321250
This commit is contained in:
Ivan A. Kosarev
2017-12-21 08:14:16 +00:00
parent 38af615b4c
commit 617c3b788a

View File

@@ -3801,8 +3801,10 @@ LValue CodeGenFunction::EmitLValueForField(LValue base,
FieldTBAAInfo.Offset +=
Layout.getFieldOffset(field->getFieldIndex()) / CharWidth;
// Update the final access type.
// Update the final access type and size.
FieldTBAAInfo.AccessType = CGM.getTBAATypeInfo(FieldType);
FieldTBAAInfo.Size =
getContext().getTypeSizeInChars(FieldType).getQuantity();
}
Address addr = base.getAddress();