Skip to content

Commit 775d335

Browse files
SaurabhJhafhahn
authored andcommitted
[Matrix] Implement += and -= for MatrixType.
Make sure CompLHSTy is set correctly for += and -= and matrix type operands. Bugzilla ticket is here https://bugs.llvm.org/show_bug.cgi?id=46164 Patch by Saurabh Jha <[email protected]> Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D98075
1 parent 8bc5ef4 commit 775d335

File tree

3 files changed

+462
-2
lines changed

3 files changed

+462
-2
lines changed

clang/lib/Sema/SemaExpr.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10551,7 +10551,11 @@ QualType Sema::CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS,
1055110551

1055210552
if (LHS.get()->getType()->isConstantMatrixType() ||
1055310553
RHS.get()->getType()->isConstantMatrixType()) {
10554-
return CheckMatrixElementwiseOperands(LHS, RHS, Loc, CompLHSTy);
10554+
QualType compType =
10555+
CheckMatrixElementwiseOperands(LHS, RHS, Loc, CompLHSTy);
10556+
if (CompLHSTy)
10557+
*CompLHSTy = compType;
10558+
return compType;
1055510559
}
1055610560

1055710561
QualType compType = UsualArithmeticConversions(
@@ -10651,7 +10655,11 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
1065110655

1065210656
if (LHS.get()->getType()->isConstantMatrixType() ||
1065310657
RHS.get()->getType()->isConstantMatrixType()) {
10654-
return CheckMatrixElementwiseOperands(LHS, RHS, Loc, CompLHSTy);
10658+
QualType compType =
10659+
CheckMatrixElementwiseOperands(LHS, RHS, Loc, CompLHSTy);
10660+
if (CompLHSTy)
10661+
*CompLHSTy = compType;
10662+
return compType;
1065510663
}
1065610664

1065710665
QualType compType = UsualArithmeticConversions(

0 commit comments

Comments
 (0)