[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 20 14:16:00 PST 2023
================
@@ -4598,8 +4602,7 @@ LValue CodeGenFunction::EmitLValueForField(LValue base,
if (base.getTBAAInfo().isMayAlias() ||
rec->hasAttr<MayAliasAttr>() || FieldType->isVectorType()) {
FieldTBAAInfo = TBAAAccessInfo::getMayAliasInfo();
- } else if (rec->isUnion()) {
- // TODO: Support TBAA for unions.
+ } else if (rec->isUnion() && !CGM.getCodeGenOpts().UnionTBAA) {
----------------
rjmccall wrote:
You've checked that this is the right rule for unions? We can just record the union as a containing aggregate that happens to have all the different union members at offset 0?
https://github.com/llvm/llvm-project/pull/75177
More information about the cfe-commits
mailing list