[PATCH] D84374: [Matrix] Add asserts for mismatched element types.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 23 08:03:51 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG24e41a34fe22: [Matrix] Add asserts for mismatched element types. (authored by braedy, committed by fhahn).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84374/new/
https://reviews.llvm.org/D84374
Files:
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
Index: llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
+++ llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
@@ -246,7 +246,7 @@
void setVector(unsigned i, Value *V) { Vectors[i] = V; }
- Type *getElementType() { return getVectorTy()->getElementType(); }
+ Type *getElementType() const { return getVectorTy()->getElementType(); }
unsigned getNumVectors() const {
if (isColumnMajor())
@@ -276,7 +276,7 @@
return getVectorTy();
}
- VectorType *getVectorTy() {
+ VectorType *getVectorTy() const {
return cast<VectorType>(Vectors[0]->getType());
}
@@ -1370,6 +1370,8 @@
const MatrixTy &Lhs = getMatrix(MatMul->getArgOperand(0), LShape, Builder);
const MatrixTy &Rhs = getMatrix(MatMul->getArgOperand(1), RShape, Builder);
+ assert(Lhs.getElementType() == Rhs.getElementType() &&
+ "Matrix multiply argument element types do not match.");
const unsigned R = LShape.NumRows;
const unsigned C = RShape.NumColumns;
@@ -1377,6 +1379,8 @@
// Initialize the output
MatrixTy Result(R, C, EltType);
+ assert(Lhs.getElementType() == Result.getElementType() &&
+ "Matrix multiply result element type does not match arguments.");
bool AllowContract = AllowContractEnabled || (isa<FPMathOperator>(MatMul) &&
MatMul->hasAllowContract());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84374.280127.patch
Type: text/x-patch
Size: 1536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200723/6f1c85f0/attachment.bin>
More information about the llvm-commits
mailing list