[clang] [Matrix] Use matrix element type for TBAA nodes. (PR #190029)

Florian Hahn via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 2 04:58:05 PDT 2026


================
@@ -329,6 +329,10 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) {
   if (CodeGenOpts.NewStructPathTBAA && Ty->isArrayType())
     return getTypeInfo(cast<ArrayType>(Ty)->getElementType());
 
+  // Accesses to matrix types are accesses to objects of their element types.
+  if (const auto *MTy = dyn_cast<ConstantMatrixType>(Ty))
+    return getTypeInfo(MTy->getElementType());
----------------
fhahn wrote:

Only `ConstantMatrixType` should reach codegen. I updated the code to use `dyn_cast<MatrixType>` and asserted that it always is `ConstantMatrixType`, thanks

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


More information about the cfe-commits mailing list