Revert "[CodeGen] Add initial support for union members in TBAA"

This reverts commit r319413. See PR35503.

We can't use "union member" as the access type here like this.

llvm-svn: 319629
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 50d116e..88116f7 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -3723,6 +3723,9 @@
   if (base.getTBAAInfo().isMayAlias() ||
           rec->hasAttr<MayAliasAttr>() || FieldType->isVectorType()) {
     FieldTBAAInfo = TBAAAccessInfo::getMayAliasInfo();
+  } else if (rec->isUnion()) {
+    // TODO: Support TBAA for unions.
+    FieldTBAAInfo = TBAAAccessInfo::getMayAliasInfo();
   } else {
     // If no base type been assigned for the base access, then try to generate
     // one for this base lvalue.
@@ -3733,26 +3736,16 @@
                "Nonzero offset for an access with no base type!");
     }
 
-    // All union members are encoded to be of the same special type.
-    if (FieldTBAAInfo.BaseType && rec->isUnion())
-      FieldTBAAInfo = TBAAAccessInfo::getUnionMemberInfo(FieldTBAAInfo.BaseType,
-                                                         FieldTBAAInfo.Offset,
-                                                         FieldTBAAInfo.Size);
+    // Adjust offset to be relative to the base type.
+    const ASTRecordLayout &Layout =
+        getContext().getASTRecordLayout(field->getParent());
+    unsigned CharWidth = getContext().getCharWidth();
+    if (FieldTBAAInfo.BaseType)
+      FieldTBAAInfo.Offset +=
+          Layout.getFieldOffset(field->getFieldIndex()) / CharWidth;
 
-    // For now we describe accesses to direct and indirect union members as if
-    // they were at the offset of their outermost enclosing union.
-    if (!FieldTBAAInfo.isUnionMember()) {
-      // Adjust offset to be relative to the base type.
-      const ASTRecordLayout &Layout =
-          getContext().getASTRecordLayout(field->getParent());
-      unsigned CharWidth = getContext().getCharWidth();
-      if (FieldTBAAInfo.BaseType)
-        FieldTBAAInfo.Offset +=
-            Layout.getFieldOffset(field->getFieldIndex()) / CharWidth;
-
-      // Update the final access type.
-      FieldTBAAInfo.AccessType = CGM.getTBAATypeInfo(FieldType);
-    }
+    // Update the final access type.
+    FieldTBAAInfo.AccessType = CGM.getTBAATypeInfo(FieldType);
   }
 
   Address addr = base.getAddress();