================ @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits