================ @@ -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(); ---------------- rjmccall wrote:
You can just do `Ty = Ty->getPointeeType()->getBaseElementTypeUnsafe();`. The "unsafety" is just incorrectness about type qualifiers, which we're fine with here. https://github.com/llvm/llvm-project/pull/116991 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits