[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

Florian Hahn via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 06:12:37 PST 2024


================
@@ -206,12 +206,14 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) {
     if (!CodeGenOpts.PointerTBAA)
       return AnyPtr;
     // Compute the depth of the pointer and generate a tag of the form "p<depth>
-    // <base type tag>".
+    // <base type tag>". Look through pointer and array types to determine the
+    // base type.
     unsigned PtrDepth = 0;
     do {
       PtrDepth++;
-      Ty = Ty->getPointeeType().getTypePtr();
-    } while (Ty->isPointerType());
+      Ty = Ty->isPointerType() ? Ty->getPointeeType().getTypePtr()
+                               : Ty->getArrayElementTypeNoTypeQual();
----------------
fhahn wrote:

Updated, thanks!

https://github.com/llvm/llvm-project/pull/116991


More information about the cfe-commits mailing list