================ @@ -852,34 +852,51 @@ void TypePrinter::printExtVectorAfter(const ExtVectorType *T, raw_ostream &OS) { void TypePrinter::printConstantMatrixBefore(const ConstantMatrixType *T, raw_ostream &OS) { + if (Policy.UseHLSLTypes) + OS << "matrix<"; printBefore(T->getElementType(), OS); - OS << " __attribute__((matrix_type("; - OS << T->getNumRows() << ", " << T->getNumColumns(); - OS << ")))"; + if (!Policy.UseHLSLTypes) { + OS << " __attribute__((matrix_type("; + OS << T->getNumRows() << ", " << T->getNumColumns(); + OS << ")))"; + } } void TypePrinter::printConstantMatrixAfter(const ConstantMatrixType *T, raw_ostream &OS) { printAfter(T->getElementType(), OS); + if (Policy.UseHLSLTypes) { + OS << ", "; + OS << T->getNumRows() << ", " << T->getNumColumns(); + OS << ">"; + } } void TypePrinter::printDependentSizedMatrixBefore( const DependentSizedMatrixType *T, raw_ostream &OS) { + if (Policy.UseHLSLTypes) + OS << "matrix<"; printBefore(T->getElementType(), OS); - OS << " __attribute__((matrix_type("; - if (T->getRowExpr()) { - T->getRowExpr()->printPretty(OS, nullptr, Policy); - } - OS << ", "; - if (T->getColumnExpr()) { - T->getColumnExpr()->printPretty(OS, nullptr, Policy); - } - OS << ")))"; } void TypePrinter::printDependentSizedMatrixAfter( const DependentSizedMatrixType *T, raw_ostream &OS) { printAfter(T->getElementType(), OS); + if (Policy.UseHLSLTypes) + OS << ", "; + else + OS << " __attribute__((matrix_type("; ---------------- llvm-beanz wrote:
You still have this in the "after" function. That will print this after pointer annotations which changes its meaning incorrectly. I'm guessing there isn't an existing test case for this, otherwise this change would have broken something. cc: @fhahn https://github.com/llvm/llvm-project/pull/111415 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits