================
@@ -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) {
----------------
dybv-sc wrote:

The goal of that patch is to re-utilize existing struct path TBAA metadata and 
amend it functionality to work for union types. Here I allow for that metadata 
to be generated for union members accesses, so yes there will be tbaa struct 
records with all members with offset 0. Later in code I adapted current 
struct-path-tbaa tree walkers to handle such situations where multiple fields 
have same offset.  

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

Reply via email to